Created
January 13, 2018 18:50
-
-
Save TutorialDoctor/bfe8ed74c3c83f8a43a9410f61801461 to your computer and use it in GitHub Desktop.
Amazon Job Application Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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