Write a recursive function called digit_count() that takes a positive integer as a parameter and returns the number of digits in the integer. Hint: The number of digits increases by 1 whenever the input number is divided by 10.

Ex: If the input is:

345
the function digit_count() returns and the program outputs:

3

Respuesta :

Using the computational knowledge in python it is possible to write a code that Write a recursive function called digit_count()

What is a function in Python?

In Python, a function is a sequence of commands that performs some task and that has a name. Its main purpose is to help us organize programs into chunks that correspond to how we envision a solution to the problem.

Writting the code in python:

def countDigits(n):

  if n< 10:

     return 1

  else:

      return 1 + countDigits(n / 10)

See more about python at brainly.com/question/13437928

#SPJ1

Ver imagen lhmarianateixeira