Reset slider values to original state

I am trying to create multiple sliders through FOR loop for storing user inputs. These sliders first render with some fixed values and the user can change these sliders to new values.
I want to give “Reset” st.button option to users where this resets sliders to its original state.
I tried deleting session_state with the Reset button. however, this does not reset the rendered slider on UI.

Here is the code:
import streamlit as st
slider =
s_min = 0
s_max = 10
default_cal = 5

if st.button(‘Reset’):
for key in st.session_state.keys():
del st.session_state[key]
slider =
f = 0

for key in st.session_state.keys():
st.write(‘keys are’)
st.write(st.session_state[key])

for i in range(3):
var_number = i
slider.append(st.slider(‘Change variable value:’, s_min, s_max, default_cal,
key=“sld_%d” % var_number ))

Hi @Pranav_s14,

Thanks for posting!

Can you share a more complete code snippet so we can try to reproduce the issue? Specifically the lines where you’re defining the sliders

Caroline :balloon:

import streamlit as st
slider =
s_min = 0
s_max = 10
default_cal = 5
number_of_sliders = 5

if st.button(‘Reset’):
for key in st.session_state.keys():
del st.session_state[key]
slider =
f = 0

for key in st.session_state.keys():
…st.write(‘keys are’+key))
…st.write(st.session_state[key])

for i in range(number_of_sliders):
…var_number = I
…slider.append(st.slider(‘Change variable value:’, s_min, s_max, default_cal,
…key=“sld_%d” % var_number ))