useful_linux_scripts/grip.py
2025-10-15 10:34:18 +01:00

13 lines
334 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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("\nTimes up! Relax your grip.")
countdown(60)