Question: arbitrary argument list (Python) Write a program that has global variables avg_int and avg_float. Write a function that will take an arbitrary number of ints/floats

arbitrary argument list (Python)

arbitrary argument list (Python) Write a program that has global variables "avg_int"

Write a program that has global variables "avg_int" and "avg_float". Write a function that will take an arbitrary number of ints/floats as arguments. In the function, you will need to process all of the values passed into the function, first determining if the number is a float or an int. You should keep track of the "total" and "number" of ints and floats so that you can calculate the average int and average float. Once you have processed all of the values from the argument list and calculated the averages, set the global variables for avg_int and avg_float. Have the function return the value "O" if the argument list was empty, "1" if the numbers were all ints, a "2" if they were all floats, and a "3" if it was a mix of ints and floats. Once you have finished a call to the function, print out the appropriate information, such as: "The list contained ints, and the average is 43.2" "The list contained a mix of ints and floats. The average of the ints was 43.2, and the average of the floats was 23.2" "There were no values in the list." Note: the Python function used to determine if a number is a float or an int is "isistance()". Part of this assignment is you looking up the documentation for this function and determining how it works

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!