-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge_day_8.py
45 lines (30 loc) · 978 Bytes
/
challenge_day_8.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Challenge Day 8
# Use the (st.slider) widget
# st.slider allows the display of a slider input widget.
# Build a simple app that shows the various ways on how to accept user input by adjusting the slider widget.
import streamlit as st
from datetime import time, datetime
st.header('ST.SLIDER')
# Example 1
st.subheader('Slider')
age = st.slider('How old are you?', 0, 130, 25)
st.write("I'm ", age, 'years old')
# Example 2
st.subheader('Range slider')
values = st.slider(
'Select a range of values',
0.0, 100.0, (25.0, 75.0))
st.write('Values:', values)
# Example 3
st.subheader('Range time slider')
appointment = st.slider(
"Schedule your appointment:",
value=(time(11, 30), time(12, 45)))
st.write("You're scheduled for:", appointment)
# Example 4
st.subheader('Datetime slider')
start_time = st.slider(
"When do you start?",
value=datetime(2020, 1, 1, 9, 30),
format="MM/DD/YY - hh:mm")
st.write("Start time:", start_time)