Question: Python Assume we have two points on a map and the coordinates of these two points are (x1,y1) and (x2,y2). Since coordinates in a map


Assume we have two points on a map and the coordinates of these two points are (x1,y1) and (x2,y2). Since coordinates in a map are never going to change, we are going to use tuples to save the coordinates values. Create a function compute._stat ist ics() that takes the two tuples as parameters. Your function should do the following: 1 Create a new variable x product and store the product of the first element of each tuple that is passed as a parameter 2 Create a now variable y2 average and store the average of the second element of each tuple. 3. Create a new tuple called stats that stores x. product and yaverage 4. Fetuin stats in your main program, input four floating point numbers x1,y1,x2, and y2 in that order. 1. Create two tuples to store these coordinates coord1 that atores (x1,y1) and coord2 that stores (x2, y2). (You can create a tuple by placing the carrespanding values inside the parentheses.) 2. Print the result of the function call with these tuples provided as an input. Check your code For example: If the input is: 4.3 10.4 5.0 4.8 the output is: ma...py Load defauit tainplate. 4Unit test 0/2 Check that your function returns a correct tuple compute statistics ((8,3,10.4),(5,4.8)) Namelirror: name ' 1 ' is not defined
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
