"Dominik Danter" <[email protected]> wrote
def recursfac(x,carryover=1):
print 'x:',x,'carryover:', carryover
if x > 1:
carryover *= x
recursfac(x-1, carryover)
No return value here so when the reursed function returns carryover
we have nowhere to go in the calling function so we return None.
else:
return carryover
This returns a value to the calling function, but in
the recursive case that returned vaklue uis thrown away
as the comment above shows.
you need to add a return statement where you call recursively.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor