Digit_sum


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/digitsum?action=lesson_resume&link_content_target=interstitial_undefined

<In what way does your code behave incorrectly? Include ALL error messages.>
Your function fails on digit_sum(434). It returns 4 when it should return 11.

<What do you expect to happen instead?>
I dont know why this is not work.

```python

Replace this line with your code.

def digit_sum(n):
__ n = str(n)
__ result = 0
__ for i in n:
____ i = int(i)
__ result = result + i
__ return result

@Edited

<do not remove the three backticks above>

#2

Hi @cloudsolver55826,

We cannot see the indentation of your code in order to evaluate it, since the code is not formatted.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.