[Tutor] Help with Max Number and Min number script
Joel Goldstick
joel.goldstick at gmail.com
Fri Sep 16 20:30:41 EDT 2016
On Fri, Sep 16, 2016 at 7:08 PM, Sharon Wallace
<swallace61 at embarqmail.com> wrote:
> inp = raw_input
The above doesn't do what you think. It creates a name called inp
which is bound to the function 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
>
>
>
What is your question? What works, or doesn't work?
>
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
--
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
More information about the Tutor
mailing list