Skip to content

Commit

Permalink
fifth project
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaryan72 committed Nov 16, 2024
1 parent 965b5a0 commit ba72b4e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 5.BasicCountdownTimer/timer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#Basic Countdown Timer:Implement a countdown timer that takes an input (number of seconds) and counts down.

import time

def basicTimer(seconds):
while seconds > 0:
print(f"Time left: {seconds} seconds")
time.sleep(1)
seconds -= 1
print("Time's up!")

try:
print("Welcome to our time machine 😎")
user_input = int(input("Enter the countdown time in seconds:"))
basicTimer(user_input)
except ValueError:
print("Please enter valid input!")

0 comments on commit ba72b4e

Please sign in to comment.