Write a programExercise 4/4Intermediate30 XP

A number with spaces

Task

The program reads a non-negative whole number (without leading zeros) and prints it with the digits split from the end into groups of three by spaces: 1234567 → 1 234 567.

Solve it by working with the string (slices, a loop) - do not use the :, format or the format function.

Examples

  • Input

    1234567

    Expected output

    1 234 567

Rules

  • Build the groups with slices - without the :, format or format.

After you submit, 6 hidden tests will also check your solution: zero, exactly three digits, four digits, six digits, eleven digits, 1234.

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.