Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write a Python code for the following question (3 points) write a function that takes four numbers that represent two points: (x1, yl) and
Please write a Python code for the following question
(3 points) write a function that takes four numbers that represent two points: (x1, yl) and (22, y2), and return the distance between them using the formula (x1 x2)2 + (y1 - y2)2 (8 points) Using the distance function from above, write a function called max_distance that takes three arguments. The first argument is a list of tuples, where each tuple has two elments representing the coordinates of a point. The second and third arguments are the x and y coordinates of a point P. The function should find the point in the list that has the maximum distance from point P. Test your function with the following line of code. print(max_distance ([(12, 12), (2, 3), (5, 4), (12, -1)], 7, 7)) print(max_distance ([(0, 0), (0, 1), (0.5, 1.5)], 1, 1)) You should get the following output (12, -1, 9.433981132056603) (0, 0, 1.4142135623730951) Process finished with exit code 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started