Another way to do that is to avoid any intermediate variables altogether That may be easier to understand YMMV
def counter(mylist, val):
if len(mylist == 0):
return 0
if mylist[0] == val:
return 1 + counter(mylist[1:], val)
else:
return counter(mylist[1:])
Asokan Pichai
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
