Skip to content

Instantly share code, notes, and snippets.

@jiyeonseo
Created March 1, 2015 13:51
Show Gist options
  • Save jiyeonseo/06bd66bad742e218594f to your computer and use it in GitHub Desktop.
Save jiyeonseo/06bd66bad742e218594f to your computer and use it in GitHub Desktop.
practice 5.2
largest = None
smallest = None
while True:
inp = raw_input("Enter a number: ")
if inp == "done" : break
try :
num = int(inp)
if smallest is None : smallest = num
elif smallest > num : smallest = num
if largest is None : largest = num
elif largest < num : largest = num
except :
print 'Invalid input'
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