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 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
Get step-by-step solutions from verified subject matter experts
