Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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_statistics () 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 new variable yaverage and store the average of the second element of each tuple. 3. Create a new tuple called s tats that stores \( x_{\text {_product }} \) and \( y_{\text {_ }} \) average 4. Return 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 stores (x1,y1) and coord2 that stores (x2,y2). (You can create a tuple by placing the corresponding 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: 8.310.45.04.8 the output is: (41.5,7.6) (conceptually, x1 and x2, however, A you cannot use these variable names, since they are not part of the function body - they were part of the main program)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

What are the key parts of an RFP?

Answered: 1 week ago

Question

Is conflict always unhealthy? Why or why not? (Objective 4)

Answered: 1 week ago