Can someone please explain why this doesn’t work?

def digit_sum(n):

n = str(n)

for x in n:

x = int(x)

result = 0

result += x

return result

If I write:

def digit_sum(n):

n = str(n)

for x in n:

x = int(x)

print x

it will return the 0434 in the window, so when I use the result += x - why won’t it add them all together?