Practice def digit_sum


def digit_sum(n):
    string = str(n)
    total = 0
    for letter in string:
        total += int(letter)
        return total


Your code is correct but doesn't run? That seems like a contradiction. What issue is the interpreter having with that assignment? Your code appears to be missing indentation, perhaps that's it? If not, then it would seem that you're sharing a different piece of code from what you're talking about!