Sum of Digits

Beginner

Time to put on your detective hat and help us solve a puzzle involving numbers!

Imagine you have a number written on a piece of paper. Your task is to figure out the sum of all the digits within that number. It's like counting jellybeans, but using numbers! 🌟

Write a function sum_of_digits that takes a positive integer as its input and returns the sum of its digits. For example, if the input is 1234, the sum would be 1 + 2 + 3 + 4 = 10.

Here are some clues and examples to get you started:

sum_of_digits(123) # returns 6 because 1 + 2 + 3 = 6 sum_of_digits(4096) # returns 19 because 4 + 0 + 9 + 6 = 19 sum_of_digits(7) # returns 7 because there's only one digit!

Remember, you can solve the puzzle by breaking the number into its individual digits, adding them up, and unveiling the secret number behind the paper! 🎩🔍

Geek
Inputs

Arg 1:

123
Expected Output
6
Actual Output