4. somme_chiffre


#1


def somme_chiffre(n):
x = str(n)
total = 0
for i in x:
total += int(i)
return total.

I don't know what is wrong with my code. An error message pop up


Replace this line with your code.


#2

Hello @arcplayer72845,

On Codecademy's forums, it is generally good practice to enclose your code in backticks

THIS THING => `

So that it is easier to read (and understand, especially with python code!)
Thanks...!


#3

I'm talking about the code.

def somme_chiffre(n):
x = str(n)
total = 0
for i in x:
total += int(i)
return total.


#4

3 posts were split to a new topic: Problem


#7

This exercise has a bug in the SCT. Your code is probably fine (as long as it works as expected). Add this after your code.

def somme_chiffre(n):
    return somme_chiffe