Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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)
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
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