How to create multiple selectbox with different key?

how to create multiple select box inside a for loop using different key .

When i tried to create it crash and display the below error:

But when i try to use st.text_input it works and display it.

raise ValueError("{} is not in iterable".format(str(x)))

code:

for i , old_val in enumerate(range(5))):
         old_val = st.selectbox(" ",old_values,key=i)

You could modify the following code for your use:

import streamlit as st

old_values = [“A”, “B”, “C”, “D”, “E”]
for i in range(len(old_values)):
old_val = st.selectbox(" “,old_values,key=f"MyKey{i}”)