Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+ Have they changed the way employers view IP?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago