DEV Community

Cover image for External Project Contribution - Release 0.3
Japneet Singh
Japneet Singh

Posted on

External Project Contribution - Release 0.3

PROJECT CONTRIBUTION REPO

Description

Countdown timer made using the Python time module and is a terminal game to countdown the time.
https://github.com/Python-World/python-mini-projects/pull/538

Development

Please have python3 installed to run this project on terminal:
Python3 Installation

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))
Enter fullscreen mode Exit fullscreen mode

Prerequisites

Modules required to be able to use the script successfully
and how to install them. Please have python3 installed to run this project on terminal:

How to run the script

python3 main.py
Enter fullscreen mode Exit fullscreen mode

Example

Enter the time in seconds: 20
00:20
Timer completed!
Enter fullscreen mode Exit fullscreen mode

Screenshot/GIF showing the sample use of the script

Image description
Pull Request

Author Name

JapneetSingh

Discussion (0)