I am building stream lit app, I know how to define if option_1 is chosen do something, but what if a user choose option 1 and option 2? I want the code doesn't runs if a user select anything rather than only option_1, even a combination of option_1 or option_2.
option_1 = st.sidebar.checkbox('df1', value=True)
option_2 = st.sidebar.checkbox('df2')
option_3 = st.sidebar.checkbox('df3')
if option_1:
"do something" ```
It sounds like you're looking for an if
/else if
statement.
option_1 = st.sidebar.checkbox('df1', value=True)
option_2 = st.sidebar.checkbox('df2')
option_3 = st.sidebar.checkbox('df3')
if option_1 and option_2:
st.write("Selected option 1 and option 1")
else if option_1:
st.write("Selected just option 1")
else if option_2:
st.write("Selected just option 2")