-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
965b5a0
commit ba72b4e
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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!") |