Question: Complete the function digits(n) that returns how many digits the number has. For example: 25 has 2 digits and 144 has 3 digits. Tip: you

 Complete the function digits(n) that returns how many digits the number

Complete the function digits(n) that returns how many digits the number has. For example: 25 has 2 digits and 144 has 3 digits. Tip: you can figure out the digits of a number by dividing it by 10 once per digit until there are no digits left. 1 - def digits(n): 2 count = 0 3- if n == 0: vou WN while (___): count += 1 return count Run 10 print(digits(25)) # Should print 2 11 print(digits(144)) # Should print 3 12 print(digits(1000)) # Should print 4 13 print(digits(0) # Should print 1 Reset

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!