← Back to challenges

Find Number of Digits in Number

PythonHardmathnumbers

Instructions

Create a function that will return an integer number corresponding to the amount of digits in the given integer num.

Examples

num_of_digits(1000) ➞ 4

num_of_digits(12) ➞ 2

num_of_digits(1305981031) ➞ 10

num_of_digits(0) ➞ 1

Notes

Try to solve this challenge without using strings!

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: H4ck3r Sp34k