[Tutor] Help with Max Number and Min number script
Bob Gailer
bgailer at gmail.com
Fri Sep 16 20:36:08 EDT 2016
On Sep 16, 2016 8:12 PM, "Sharon Wallace" <swallace61 at embarqmail.com> wrote:
>
In addition to showing us your code ,
Please show us whatever Trace back you got when you ran the code. I would
guess you are either getting an indentation error or syntax error in the
vicinity of line that begins if num =.
> 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'
>
> 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
>
>
>
>
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list