I am trying to make a simple app that could be used to multiply two integers (by using random numbers):
from random import randint import streamlit as st x = randint(1, 10) y = randint(1, 10) result = x * y st.write(x, ' * ', y , '= ') #, x*y) st.write('_________') answer = int(st.text_input('Please enter your answer ', 1)) st.write('Your answer is', answer) st.write('The correct answer is', result) if answer == result: st.success('Your answer is correct!') st.balloons() else: st.warning("OOOPS, please try again!")
When I run the code it gives me “OOOPS, please try again!”, as shown in the figures:
I think the problem comes from this statement answer = int(st.text_input('Please enter your answer ', 1)). Could anybody help, please?