Question 3 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.
Answers
Answered by
0
Answer:
In python:
n = int(input()) //taking input
string = str(n) //converting to string
c=0
for num in string: //each digit or char from string
c=c+1 //counting
print(c)
Similar questions