Beginnger Question

Matthew Baulch matt at greenroom.com.au
Tue Apr 9 11:28:44 EDT 2002


¨ wrote:

> Matthew Baulch <matt at greenroom.com.au> wrote in message
> news:3CB3039C.3040108 at greenroom.com.au...
> 
>>I think the code you are looking for could be:
>>
>>x = 2
>>
>>def wrong(num):
>>   return num + 1
>>
>>x = wrong(x)
>>print x
>>
>>x = wrong(x)
>>print x
>>
>>
> 
> I'm a newbie myself, so this is probably wrong, but wouldn't this be *even*
> better?


> x = 2
> def wrong(num):
>     x = x+1
>     print x
> 
> wrong(x)
> wrong(x)
> 


Not wrong, just different!




More information about the Python-list mailing list