There is only 1 ques with 2 part.please answer them.( Please answer in python) Part I : Define a function called larger with 2 parameters. The function should compute which is the larger and should subtract the smaller from the larger (regardless of the order of arguments). Call the function four times using the following arguments: (75, 59) (43, 45) (-5, 19) (35, -35) Output Example: 16 2 24 70 Part II Gas Price Averaging a) Write a function average with a parameter prices that can accept an arbitrary number of integer values. This function returns the average of all values. b) Call the average function with the following arguments: 2.95, 3.25, 3.10, 3.19 c) Call the average function with the following arguments: 4.09, 3.89, 3.75 d) Print and format the returned results with the average computed to two decimal places. Match the output below. Output Example Village gas prices at the start of the year averaged $3.12 Village gas prices today average $3.91
There is only 1 ques with 2 part.please answer them.( Please answer in python)
Part I :
Define a function called larger with 2 parameters. The function should compute which is the larger and should subtract the smaller from the larger (regardless of the order of arguments). Call the function four times using the following arguments:
(75, 59)
(43, 45)
(-5, 19)
(35, -35)
Output Example:
16 2 24 70
Part II
Gas Price Averaging
a) Write a function average with a parameter prices that can accept an arbitrary number of integer values. This function returns the average of all values.
b) Call the average function with the following arguments: 2.95, 3.25, 3.10, 3.19
c) Call the average function with the following arguments: 4.09, 3.89, 3.75
d) Print and format the returned results with the average computed to two decimal places. Match the output below.
Output Example
Village gas prices at the start of the year averaged $3.12
Village gas prices today average $3.91
Step by step
Solved in 6 steps with 3 images