python grip timer
This commit is contained in:
parent
3141c9817f
commit
f1a799344f
12
grip.py
Normal file
12
grip.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
|
def countdown(seconds):
|
||||||
|
print(f"Hold your grip for {seconds} seconds!")
|
||||||
|
for remaining in range(seconds, 0, -1):
|
||||||
|
mins, secs = divmod(remaining, 60)
|
||||||
|
print(f"{mins:02}:{secs:02}", end="\r") # overwrite the same line
|
||||||
|
time.sleep(1)
|
||||||
|
print("\nTime’s up! Relax your grip.")
|
||||||
|
|
||||||
|
countdown(60)
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user