We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 51b8d95 + d826158 commit 111e700Copy full SHA for 111e700
Basic Scripts/CountdownTimer.py
@@ -0,0 +1,27 @@
1
+import time
2
+
3
+# The countdown function is defined below
4
5
+def countdown(t):
6
7
+while t:
8
9
+mins, secs = divmod(t, 60)
10
11
+timer = '{:02d}:{:02d}'.format(mins, secs)
12
13
+print(timer, end="\r")
14
15
+time.sleep(1)
16
17
+t -= 1
18
19
+print('Lift off!')
20
21
+# Ask the user to enter the countdown period in seconds
22
23
+t = input("Enter the time in seconds: ")
24
25
+# function call
26
27
+countdown(int(t))
0 commit comments