Created
June 29, 2020 11:46
-
-
Save uroybd/476bdfb7911601aff30b4dd4bd932a3e to your computer and use it in GitHub Desktop.
Largest and Smallest
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
import sys | |
largest_by_far = sys.float_info.min | |
smallest_by_far = sys.float_info.max | |
while True: | |
value = input("Enter Numbers: ") | |
if value == "done": | |
break | |
try: | |
fvalue = float(value) | |
largest_by_far = max(fvalue, largest_by_far) | |
smallest_by_far = min(fvalue, smallest_by_far) | |
except: | |
print("Invalid Input") | |
continue | |
print(f"Maximum is: {largest_by_far}") | |
print(f"Minimum is: {smallest_by_far}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment