I need to create a loop that asks for users to input integers until entering the string "done", then the loop breaks and prints out the lowest and highest integer the user has entered.
This is what I have so far but I can't seem to get it work properly...
Any help? I'm just starting to learn Python. 🙂
When I run this, it works, but it will print out the wrong numbers. Sometimes the smallest is actually the larges, or vice versa, and sometimes it takes multiple times to enter "done" for the loop to actually break. I'm not sure what's wrong.
This is what I have so far but I can't seem to get it work properly...
Any help? I'm just starting to learn Python. 🙂
Code
largest = None
smallest = None
while True:
num = raw_input("Enter an integer: ")
if num == "done" :
break
elif largest is None :
largest = num
elif smallest is None :
smallest = num
elif num > largest :
largest = num
elif num < smallest :
smallest = num
print num
print "Minimum", smallest
print "Maximum", largestWhen I run this, it works, but it will print out the wrong numbers. Sometimes the smallest is actually the larges, or vice versa, and sometimes it takes multiple times to enter "done" for the loop to actually break. I'm not sure what's wrong.

