Skip to content

natnew/Python-Projects-Countdown-Timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Python Projects: Countdown Timer 🐍

Python Script
This repo contains python code that generates a timer.
Run the code.

Python

import time

def countdown(t):
    while t:
        mins, secs = divmod(t, 60)
        timer = '{:02d}:{:02d}'.format(mins, secs)
        print(timer, end="\r")
        time.sleep(1)
        t -= 1


    print('Timer completed!')

t = input('Enter the time in seconds: ')

countdown(int(t))

Output

00:60
Timer completed!

About

Python Projects Countdown Timer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages