I'm having trouble with the digital_sum exercise of Practice Makes Perfect:
I think I already have the answer; however, I keep getting this error message:
Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11.
Here is my code:
n = raw_input('Enter number') def digit_sum(n): n = str(n) s = 0 for i in n: s = s + int(i) print s digit_sum(n)
The weird part is that I've tried it with 434 and I do get the desired result of 11. Any help?