- Engineering
- Computer Science
- please create a program in python using turtle to plot...
Question: please create a program in python using turtle to plot...
Question details
Please create a program in Python using Turtle to plot the following coordinates:
Object A: (67.35, 71.18)
Object B: (22.33, -173.09)
-Then, ask the user to input the coordinates of their current location,
-Then ask the user which distance function they would like to use to determine how far the object is
****Here is the code for the distance functions available, (Manhattan or Euclidean)***
def absolute(x):
if x > 0:
return x
else:
return -x
def manhattan(x1,y1,x2,y2):
return absolute(x2 - x1) + absolute(y2 - y1)
def euclidean(x1,y1,x2,y2):
distance = ((( x2 - x1) ** 2) + ((y2 - y1) **2)) ** 0.5
return distance
-Draw their current location on the screen using turtle and report which object is closest according to which distance function they chose
Solution by an expert tutor
