Last active
January 19, 2024 02:37
-
-
Save ohr-emet/399742c358206b0587921bba153f1de3 to your computer and use it in GitHub Desktop.
py4e 5.2 Assignment - [Solved, Working solution] [Only review after you have tried _everything_ ]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
largest = -1 | |
smallest = None | |
while True : | |
num = input('Enter a number: ') | |
if num == "done" : | |
break | |
try: | |
i_num = int(num) | |
except: | |
print('Invalid input') | |
continue | |
if i_num > largest: | |
largest = i_num | |
if smallest is None : | |
smallest = i_num | |
elif i_num < smallest : | |
smallest = i_num | |
print("Maximum is", largest) | |
print("Minimum is", smallest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worked perfectly, great coding.