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

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to