complete the function digits(n) that returns how many digits the number has. 1

complete the function digits(n) that returns how many digits the number has.

def digits(n):
  return len(str(n))

Here is what the above code is Doing:
1. We’re creating a function called digits that takes in a number n.
2. We’re returning the length of the string representation of n.

Similar Posts