Archived
1
0
Fork 0
This repository has been archived on 2024-05-10. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
PY4E/Assignment 5.2/main.py
Michael Loveys bb326fbd0a inital commit
2021-09-08 10:33:48 -05:00

32 lines
No EOL
817 B
Python

smallest = None
largest = None
# Start Loop until done is received and both smallest and largest have values
while True:
number = input("Please enter a number: ")
try:
number = int(number)
except:
if number == "done":
if smallest is None or largest is None:
print("Not Enough Information to determine smallest and largest")
else:
print("Maximum is", largest)
print("Minimum is", smallest)
break;
else:
print("Invalid input")
continue
if smallest is None:
smallest = number
elif number < smallest:
smallest = number
if largest is None:
largest = number
elif number > largest:
largest = number