https://paiza.jp/works/mondai/loop_problems2/loop_problems2__digit_sum
私の回答
n = input()
ans = 0
for i in range(len(n)):
ans += int(n[i])
print(ans)
模範解答
N = int(input())
digit_sum = 0
while N > 0:
digit_sum += N % 10
N //= 10
print(digit_sum)
全く違う書き方でした。