Created
May 2, 2024 14:55
-
-
Save akasakaid/ba18fad1447e7598fe2acdf35cf2aeeb to your computer and use it in GitHub Desktop.
countdown with python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def countdown(t): | |
| while t: | |
| menit,detik = divmod(t,60) | |
| jam,menit = divmod(menit,60) | |
| jam = str(jam).zfill(2) | |
| menit = str(menit).zfill(2) | |
| detik = str(menit).zfill(2) | |
| print(f'waiting until {jam}:{menit}:{detik} ',flush=True,end='\r') | |
| t -= 1 | |
| time.sleep(1) | |
| print(' ',flush=True,end='\r') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment