[Tutor] thesaurus

Emile van Sebille emile at fenx.com
Sun Jul 12 21:34:21 CEST 2009


On 7/12/2009 12:01 PM Pete Froslie said...
> (2)not sure why this function doesn't work:
> 
> word_count = 0 #set up variable to increment through text
> 
>     def increment(x):
>             return  x+1
> 
>     increment(word_count)

You need to capture and assign the result (or possibly restructure to 
work with a mutable or simply use word_count+=1 ):

word_count = increment(word_count)

Emile



More information about the Tutor mailing list