Challenge: Sum of Digits

Lab Python Beginner 10 points

Read a whole number and print the sum of its digits. For 2026 that's 2 + 0 + 2 + 6 = 10.

Input

One non-negative whole number.

Output

The sum of its digits.

Example

Input

2026

Output

10
Sample input available Sample output available
Editor
Python

Hints

Keep the input as text and loop over its characters.

int(digit) turns "7" into 7.

Solution explanation

Looping over the string gives one digit at a time. Convert each with int() and add it to a total. (Another way uses % 10 and // 10 in a while loop.)

Show solution
number = input()
total = 0
for digit in number:
    total += int(digit)
print(total)
Output
Answer
HOME LEARN COMMUNITY DASHBOARD