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
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