Skip to content

Instantly share code, notes, and snippets.

@TutorialDoctor
Created January 13, 2018 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TutorialDoctor/bfe8ed74c3c83f8a43a9410f61801461 to your computer and use it in GitHub Desktop.
Save TutorialDoctor/bfe8ed74c3c83f8a43a9410f61801461 to your computer and use it in GitHub Desktop.
Amazon Job Application Code
import cmath
#https://www.youtube.com/watch?v=eaYX0Ee0Kcg
#This is my solution to the problem he provided.
points = [(-2,4),(0,-2),(-1,0),(2,5),(-2,-3),(3,2)]
orign = (0,0)
print(points)
def get_distance_between(P1,P2):
distance = cmath.sqrt((P2[1]-P1[1])**2+(P2[0]-P1[0])**2)
return distance
for x in points:
print(x,get_distance_between(x,orign))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment