i want to calculate sum of every digit. For example, if we have number 134,we calculate 1+3+4 =8 and print it out. I did this in c, it works fine but when i try it in python it doesn't work. Here is my code: python code
Asked
Active
Viewed 43 times
-1
-
2Please include the code in your question itself. Do not paste pictures of your code. See [how to ask ?](https://stackoverflow.com/help/how-to-ask) – Imanpal Singh May 12 '20 at 15:32
-
I dont have internet connection on my pc at the moment. Im writing from my phone – Mehmetali Karadağ May 12 '20 at 15:33
-
1Does this answer your question? [Why does my recursive function return None?](https://stackoverflow.com/questions/17778372/why-does-my-recursive-function-return-none) – Mark Dickinson May 12 '20 at 16:55
1 Answers
1
the problem in your code is that it has no return
statement; by default, Python will return None
.
That being said, I would recommend you to add the code to the question in the next questions; just as skrrrt commented :).

Rodrigo De Rosa
- 96
- 5
-
U r right, i should have added the code but as i mentioned i dont have net connection on my pc at the moment. Hot can i resolve the problem, i wanna return the top value – Mehmetali Karadağ May 12 '20 at 15:55
-
1Try changing the call to "get(sayi, top)" for "return get(sayi, top)" in line 49. – Rodrigo De Rosa May 12 '20 at 18:14