On 17/09/16 00:08, Sharon Wallace wrote:
> inp = raw_input
> largest = None
> smallest = None
> while True:
> num = raw_input('Enter a number: ')
> if num = 'done' : break
> print num
> try :
> num = float(inp)
> except :
> print 'Invalid input'
While some whitespace is good, too much is as bad as none.
I've removed most of the blank lines but your indentation
levels are way too big. Also they are inconsistent and
in some places wrong. Indentation is crucially important
Your code above should look like:
largest = None
smallest = None
num = raw_input('Enter a number: ')
if num = 'done' :
num = float(inp)
print 'Invalid input'
That uses the recommended 4 spaces indentation and makes it
much easier to see what is going on.
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options: