Spaces:
Build error
Build error
File size: 1,471 Bytes
ef9ebac 603e895 3474cc9 603e895 3474cc9 603e895 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import streamlit as st
tab1, tab2, tab3 = st.tabs(["Cat", "Calculadora", "Història"])
with tab1:
st.header("Un gat")
st.image("https://static.streamlit.io/examples/cat.jpg", width=200)
with tab2:
st.header('Calculadora')
num1 = st.number_input('Entra el primer número:')
num2 = st.number_input('Entra el segon número:')
if st.button('Sumar'):
st.write(f'El resultat és: {num1+num2}')
with tab3:
st.title("Història")
col1, col2 = st.columns(2)
c = 0
with col1:
if st.button("Fàcil"):
st.write("Has triat el nivell fàcil! Ara se't presentaran 10 preguntes sobre història. Quantes encertaràs? Respon introduint la lletra de l'opció en minúscula.")
# Pregunta 1
resposta1 = st.text_input("Qui va ser el primer president dels Estats Units?")
st.write("a) Abraham Lincoln")
st.write("b) George Washington")
st.write("c) Thomas Jefferson")
st.write("d) Franklin D. Roosevelt")
if st.button("Comprova"):
if resposta1 == "":
st.write("")
elif resposta1 == "b":
st.write("Correcte! Més 1 a la puntuació.")
c += 1
elif resposta1 != "b":
st.write("Incorrecte, no sumes punt.")
with col2:
st.title("Comptador de punts:")
st.write(f"Has aconseguit {c} punts") |