By using the while loop get numbers as input from the user and add them to the list. If the user enters 'done' then the program output maximum and minimum number from the list.
This code also includes the error message using the 'try and except' block for wrong inputs.
nums = list()
while(True):
x = input("Enter a Number: ")
if x == "done":
break
try:
inp = float(x)
nums.append(inp)
except:
print("Enter only numbers or type 'done'")
continue
print("Maximum: ", max(nums))
print("Minimum: ", min(nums))
Input: 1, 2, 3, 4, er, done,...
Issue: 'er' input did not call except block, instead kept taking inputs. Somehow the Program was still running even after typing 'done' and kept taking input.
Tried: Added print(x) after line:3 but did not get any output for that either.