I need your help.
I have edited the following code which I would like to do the following:
1. Continuously Prompt user to input until they enter "done". This works.
2. Once "done" is entered, print the largest and smallest of the numbers. Initially it does but what I would like is to be able to keep track of the earlier entries without having "largest" and "smallest" variables as I have. I would like the user to try to enter as many times, with me just printing the largest of those entries and the smallest.
Kindly asking for guidance.
My code is below:
I have edited the following code which I would like to do the following:
1. Continuously Prompt user to input until they enter "done". This works.
2. Once "done" is entered, print the largest and smallest of the numbers. Initially it does but what I would like is to be able to keep track of the earlier entries without having "largest" and "smallest" variables as I have. I would like the user to try to enter as many times, with me just printing the largest of those entries and the smallest.
Kindly asking for guidance.
My code is below:
largest = None smallest = None while True: num = input("Enter a number: ") if num == "done": largest = input("Enter Max") smallest = input("Enter Min") print("Maximum", largest) print("Minimum", smallest) break try: entryStuff = float(num) except: print("Invalid input") print("Maximum", largest)