
5.2
By:
dvdjaco on
Feb 21st, 2012 | syntax:
Python | size: 0.41 KB | hits: 23 | expires: Never
# #!/usr/bin/python
#
# By dvdjaco
# Exercise 5.2
#
# Write another program that prompts for a list of numbers as above and at the end
# prints out both the maximum and minimum of the numbers instead of the average.
l = list()
while True:
num = (raw_input("Enter a number: "))
if num == 'done' : break
try:
l.append(float(num))
except:
print "Invalid input"
print max(l), min(l)