[Tutor] stuck on null values
joel.goldstick at gmail.com
Fri Mar 16 20:08:55 CET 2012
On Fri, Mar 16, 2012 at 3:02 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 16/03/12 14:44, Joel Goldstick wrote:
>> Take a look at this:
>> while True:
>> num = raw_input("give me an integer: ")
>> n = int(num)
>> print "Sorry, that wasn't and integer!"
> The pass is redundant it does nothing (thats its purpose! :-)
> You can also remove the variable n:
> while True:
> num = int(raw_input("give me an integer: "))
> # use num now or keep it for later
> print "Sorry, that wasn't an integer!"
> # can also use num here...
> Alan G
> Author of the Learn to Program web site
Good Catch! I originally had the pass in alone, but then decided to
give a helpful message. Didn't remove the pass
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor