How Many Digits

Counting digits is useful when you need to check the length of a code, order number, or numeric ID. The function count_digits receives a non-negative integer n and returns how many digits it contains. The number 0 counts as one digit.

Примеры

Ввод
0
Вывод
1
Ввод
7
Вывод
1
Ввод
12345
Вывод
5

Нужно реализовать

def count_digits(n: int) -> int:

Теги

math
PostgreSQLv16

Tady se objeví výsledek běhu kódu

Visible tests
1
Input
0
Expected1
2
Input
7
Expected1
3
Input
12345
Expected5
4
Input
100
Expected3
5
Input
99
Expected2
6
Input
999999
Expected6
Focus radio
Paused · SomaFM · Fluid