Adding up the digits

Write code · Basic · §1.1 Digits

Complete the function solution, which returns the sum of the digits of the non-negative integer n.

Function

solution(n)

Constraints

Examples

nresult
1236
908118

Starter code

def solution(n):
    answer = 0
    return answer

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.