The sum of the digits

Write code · Medium · §7.4 While it is true

Add up all the digits of n, and store the sum in total. Keep taking off the last digit and adding it until n becomes 0.

Starter code

n = 4096

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.