Write a programElementary20 XPExercise 1/9

Time in seconds

Task

The program repeatedly reads a time in seconds until the user enters -1. For every time it prints how many hours, minutes and seconds that is, as h:mm:ss - minutes and seconds always with two digits, hours as they come out (even over 24).

Handle bad input: if a value is not a non-negative whole number (for example abc, 2.5 or -5), print zly vstup (bad input) and carry on.

What the program should do

3661 seconds is 1:01:01.

Examples

  • Input

    3661
    59
    -1

    Expected output

    1:01:01
    0:00:59
  • Input

    abc
    7200
    -1

    Expected output

    zly vstup
    2:00:00

Rules

  • Use a while loop in this lesson.

After you submit, 5 hidden tests will also check your solution: almost a whole day, more than a day, a negative number and zero, ending at once, a decimal number.

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.