These are chat archives for cpoole/connorGeneral

28th
Mar 2016
Connor Poole
@cpoole
Mar 28 2016 01:36
largest = None
smallest = None
while True:
   num = raw_input("Enter a number: ")
   if num == "done" : break
   print num

print "Maximum", largest
5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter the numbers from the book for problem 5.1 and Match the desired output as shown.
Connor Poole
@cpoole
Mar 28 2016 01:53
largest = None
smallest = None
while True:
    num = raw_input("enter a number ")
    try:
        num = int(num)
    except ValueError:
        if num == "done":
            break
        print "bullcrap, enter a real int"
        continue
    if largest == None:
        largest = num
    if smallest == None:
        smallest = num
    if num > largest:
        largest = num
    if num < smallest:
        smallest = num

print "Maximum", largest
print "Minimum", smallest