yashm commited on
Commit
5ecafea
·
verified ·
1 Parent(s): 5ce9360

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import time
3
+
4
+ def countdown(t):
5
+ while t:
6
+ mins, secs = divmod(t, 60)
7
+ timer = '{:02d}:{:02d}'.format(mins, secs)
8
+ print(timer, end="\r") # Overwrites the previous line.
9
+ time.sleep(1)
10
+ t -= 1
11
+
12
+ st.title("Timer App")
13
+
14
+ minutes = st.number_input("Enter the number of minutes", min_value=0, value=3, step=1)
15
+ seconds = st.number_input("Enter the number of seconds", min_value=0, value=0, step=1)
16
+
17
+ total_time = minutes * 60 + seconds
18
+
19
+ if st.button("Start Timer"):
20
+ countdown(int(total_time))