Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started