Problem using text_input

Here’s a simple use-case for what I am trying to build.
I am asking a question, and seeking answer from user. Then I am printing what user gave as input and what I was expecting. it doesn’t seem to work. After accepting input, it just refreshes without printing the input that was entered in the entry box. Am I missing something?

import numpy as np
import streamlit as st
a = [1,2,3,4,5,6,7,8,9,10]
b = [x*10 for x in a]
tmp = np.random.choice(np.arange(0,10))
inp = a[tmp]
rng = st.text_input('Enter 10 times '+str(inp))
if rng is not None:
st.write('You entered '+rng)
st.write('Correct answer '+str(b[tmp]))