Created
February 15, 2013 16:22
-
-
Save tombrad/4961459 to your computer and use it in GitHub Desktop.
Max and min initializing with None
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
max = None | |
min= None | |
while True: | |
num = raw_input("Enter a number: ") | |
if num == "done" : break | |
if len(num)<1 : break | |
try: | |
num = float(num) | |
except : | |
print "Invalid input" | |
continue | |
if num > max or max == None: | |
max= num | |
if num < min or min == None: | |
min = num | |
print "Maximum is", max | |
print "Minimum is", min |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment