The digit sum and the number of digits

Write code · Medium · §6.5, §7.4 While it is true

For the positive integer n, store the sum of its digits in digit_sum and the number of digits in digits. Use while, % 10, and // 10. For 30507, the sum is 3 + 0 + 5 + 0 + 7 = 15, and there are five digits. In the challenge test, n is 0, which counts as one digit.

Starter code

n = 30507
digit_sum = 0
digits = 0
# Write your loop here
print(digit_sum, digits)

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.