Skip to content

Instantly share code, notes, and snippets.

@Igaryu
Last active April 16, 2023 09:20
Show Gist options
  • Save Igaryu/501c5ff31df925a1197b11e64c4c9bdf to your computer and use it in GitHub Desktop.
Save Igaryu/501c5ff31df925a1197b11e64c4c9bdf to your computer and use it in GitHub Desktop.
from time import sleep
def countdown(t):
'''
Defines a countdown and prints always in the same position che counter
'''
while t:
mins, secs = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
sleep(1)
t -= 1
print('End of countdown.')
timeout = int(input("Enter the time in seconds: "))
countdown(timeout)
@Igaryu
Copy link
Author

Igaryu commented Jul 30, 2020

I wonder why, if I set tabs as 2 spaces once confirmed and saved, the editor, transforms it into tab 8!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment