On 17/09/16 00:08, Sharon Wallace wrote:
> largest = None
> smallest = None
>
> while True:
> num = raw_input('Enter a number: ')
> if num = 'done' : break
should use == to test equality a single = is
an assignment and would give an error here
print num
try :
num = float(inp)
except :
Don't use a bare except here, specify the error,
otherwise you potentially miss a lot of useful
debug information. Specifically you want to
catch ValueError here.
print 'Invalid input'
continue
if largest is None or num > largest :
largest = num
if smallest is None or num < smallest :
smallest = num
> print 'Maximum is:', largest
> print 'Minimum is:', smallest
Fix those errors and it should work
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor