On Sep 17, 2016 4:55 PM, "Sharon Wallace" <swallac...@embarqmail.com> wrote:
>
> Would you please help me with the last piece of this assignment?
>
>
>
> This is my code:
>
>
>
> largest = None
>
> smallest = None
>
>
>
> while True:
>
>                 num = raw_input("Enter a number:  ")
>
>                 if num == "done" : break
>
>                 print num
>
>
>
>                 try :
>
>                                 num = int(num)
>
>                 except :
>
>                                 print "Invalid input"
>
>                                 continue
>
>
>
>                 if num > largest :

> comparing integers To None is not a good idea. Your earlier program had
it right when you tested for None and greater than /  less then.

Another way to tackle this is to initialize largest to some extremely large
negative value and I smallest to some extremely large positive value.

When replying to these emails please always include the tutor group.

Congratulations on persisting and making it this far.

>                                 largest = num
>
>
>
>                 if num < smallest :
>
>                                 smallest = num
>
>
>
> print 'Maximum is', largest
>
> print 'Minimum is', smallest
.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to