← Back to Classes
Question 517
Ticking Timer
Ticking Timer
Write the whole Timer class. The constructor stores seconds as a whole number; tick() takes one second off but never lets the value drop below 0, so a tick at 0 changes nothing; is_done() returns True once seconds is exactly 0. Do NOT write a main block or any top-level test code; the tests construct the class. Input: two lines, the starting seconds and the number of ticks, read by the tests as whole numbers; they call tick that many times, then print the remaining seconds and what is_done returns on separate lines.
Expected Output:
2 False
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.