Question: PYTHON: digital root using loops. I'm not sure how to fix my current code: >>> number = 5437 >>> count = 0 >>> while number

PYTHON: digital root using loops.

I'm not sure how to fix my current code:

>>> number = 5437

>>> count = 0

>>> while number > 0:

count += number % 10

number = number // 10

return count

>>> count

19

The loop should continue so that it is 1+9 = 10 -> 1+0 = 1, hence return a single digit number. However, the loop stops at the first round of sum, and ends at 19. I don't know how to get it to continue.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!