Write a programBasic10 XPExercise 1/16

Digit sum

Task

The program reads one non-negative whole number (it may have dozens of digits) and prints its digit sum - the sum of all its digits.

For example, the digit sum of 12345 is 1 + 2 + 3 + 4 + 5 = 15.

Examples

  • Input

    12345

    Expected output

    15

After you submit, 4 hidden tests will also check your solution: zero, all nines, a one and zeros, a 30-digit number.

Python starts the first time you run code.

Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.

Input (stdin)

Each line = one call to input().

Output

Hints

Try it yourself first. Each hint reveals a little more - and lowers the reward a little.

Signed out, hints are free - but no XP is awarded either.

Solution

The solution unlocks after the last hint.