With form radio button and select box not working

Ask the community or our support engineers for answers to questions.

import streamlit as st

with st.form("test1"):
    genre = st.radio("What's your favorite movie genre",('Comedy', 'Drama', 'Documentary'))

    if genre == 'Comedy':
        st.write('You selected comedy.')
    else:
        st.write("You didn't select comedy.")
    check_fn=st.form_submit_button("Check_function")

With in form If select the radio buttons the content is not changing . Can you help how to handle this .

Not sure what the problem is. Looks like it works on my side.

What i mean is before clicking on submit button the radio button is not working.
As per radio button want to do some operations .Simillar to like below.
Something like dynamic form as per options.

import streamlit as st

with st.form("test1"):
    genre = st.radio("What's your favorite movie genre",('Comedy', 'Drama', 'Documentary'))
    dict1=dict()
    if genre == 'Comedy':
        fun_name=st.text_input("please enter function name")
        if len(fun_name.split())>0:
            col1,col2 =st.beta_columns([5,2])
            dict1=dict()
            for i in fun_name.split():
                col1.write(i)
                dict1[i]=col2.text_input('Enter number of times')
    else:

        fun_input=st.text_area("Please enter details")
        dict1={v.split()[0] : v.split()[1]for v in fun_input.split('\n')}


    check_fn=st.form_submit_button("Check_function")
    if check_fn:
        pass