How do I create a list of values with st.slider in a loop?

I’m trying to use st.slider to allow a user to input new values to a list and then append that list of values to a dataframe called model_cities. Right now it’s only saving the last value.

for x in (model_cities):
model_count =
x = st.slider(x, max_value=500, value=0)
model_count.append(x)

Not sure what I’m doing wrong. Is there an easier way to accomplish this?

This worked for me.

import streamlit as st
model_cities = [‘A’, ‘B’]
model_count =
for i, x in enumerate(model_cities):
model_count.append(st.slider(x, max_value=500, value=0, key=“city_%d” % i))
st.write(model_count)

Output:
{
“A”: 149, # Slider controlled
“B”: 260 # Slider controlled
}