Question: . Define a function that returns either the product or sum of two numbers. (10 pts) The function takes two parameters x and y. Give

. Define a function that returns either the product or sum of two numbers. (10 pts)

  • The function takes two parameters x and y.

  • Give the function a descriptive name that corresponds to its task.

  • The function returns the product of x and y if the product is greater than -1000 but less than 1000.

  • Otherwise, the function returns the sum of x and y.

  • After the definition of the function, call the function two times, once by passing 24.8 and 34.7 to the function as arguments and the other time by passing 24.8 and -57.9 to the function as arguments. Use the print function to display both results (returned by the function you defined).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!