Write a programExercise 2/4Elementary20 XP

Counting digits recursively

Task

Write a recursive function pocet_cifier(n) that returns the number of digits of a non-negative whole number n. The number 0 has one digit too.

Do not use loops or the len and str functions.

Examples

  • Call

    print(pocet_cifier(12345))

    Expected output

    5

Rules

  • Solve it with recursion and division - no loops, len or str.

After you submit, 4 hidden tests will also check your solution: zero, one digit, 10, a million.

Python starts the first time you run code.

Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.

Input (stdin)

Each line = one call to input().

Output

Hints

Try it yourself first. Each hint reveals a little more - and lowers the reward a little.

Signed out, hints are free - but no XP is awarded either.

Solution

The solution unlocks after the last hint.