Question: looking for actual code Use a loop to accept commands from the user. This loop must support the following commands: a. a: Ask the user
Use a loop to accept commands from the user. This loop must support the following commands: a. "a": Ask the user for a number, and add it to a list. i. You can assume that the user will always provide a valid number. b. "M": Find the largest number in the list, and output this value. i. If the list has no elements, print "No elements in list." ii. HINT: You can either start your search by declaring the first value in the list the maximum, or by initializing your maximum to the value sys.float_info.min, so anything will be larger than it. c. " m ": Find the smallest number in the list, and output this value. i. If the list has no elements, print "No elements in list." ii. HINT: You can either start your search by declaring the first value in the list the minimum, or by initializing your minimum to the value sys.float_info.max, so anything will be smaller than it. d. " q ": Stop looping and end the program. e. Any other command is invalid. However, the loop will continue until the user enters a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
