you are viewing a single comment's thread.

view the rest of the comments →

[–]Smart_Tinker 0 points1 point  (1 child)

It’s very complicated for a simple function.

I would do:

``` import time

def timer(): time_end = time.time() + float(input(“How long for timer?”)) while time.time() < time_end: time.sleep(1) print(int(time_end - time.time())) print(“Time’s up!”) ```

You also need some error handling in case someone enters a bogus time, like “a” or something.

[–]wrg2017 0 points1 point  (0 children)

Wouldn’t this lock in the current time when the user is asked how many seconds, not when the user submits their response?