# Sum of Digits

Easy

13

1

77.4% Acceptance

In this lab you need to implement a function named `sum_of_digits`

in Python. This function takes a single integer parameter and calculates the sum of its digits. The process repeats on the sum until a single-digit number is obtained. The function should then return this single-digit result.

For example:

- If the input is
`29`

, the function calculates`2 + 9 = 11`

, then repeats the process to get`1 + 1 = 2`

. Thus, the output is`2`

. - For
`12345`

, the sum is`1 + 2 + 3 + 4 + 5 = 15`

, then`1 + 5 = 6`

. Therefore, the output is`6`

.

The function should handle inputs ranging from single-digit numbers to multi-digit numbers, including edge cases like `0`

. Your implementation will be tested against a series of challenges to validate its correctness under various scenarios.