Project Skills Needed
This project covers the following concepts. Click any link to learn more about them if you're unfamiliar.
input() function | print() function | strings | while-loops |
Project Description
Build a countdown timer with Python.
How the Project Works
(1) The program starts by prompting the user to enter the time in seconds (e.g., 10 seconds). (2) Then, the program starts printing out the seconds (e.g., 00:10, 00:09, etc.) one line every one second. (3) At the end, the program prints out “Time is up!”
Prerequisites
Required Libraries: time
Required Files: No files are required.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
See our code below for this project:
timer=int(input("Please enter the value"))
while timer >= 0 :
hour=timer//60
minutes=timer%60
formatted_time = f"{hour:02d}:{minutes:02d}"
print(formatted_time)
timer -= 1
print("Time\'s up" )