import streamlit as st
import time
# Page configuration
st.set_page_config(page_title="Malus Quiz π", page_icon="π", layout="centered")
# Initialize session state
if 'page' not in st.session_state:
st.session_state.page = 1
if 'score' not in st.session_state:
st.session_state.score = 0
if 'answers' not in st.session_state:
st.session_state.answers = {}
if 'slider_value' not in st.session_state:
st.session_state.slider_value = 50
# Correct answers
correct_answers = {
'q1': 'a',
'q2': 'c',
'q3': 'a',
'q4': 'c'
}
# Custom CSS for animations and styling
st.markdown("""
<style>
.big-font {
font-size: 30px !important;
font-weight: bold;
text-align: center;
}
.emoji-rain {
font-size: 50px;
animation: fall 3s linear infinite;
}
@keyframes fall {
0% { transform: translateY(-100px); opacity: 1; }
100% { transform: translateY(600px); opacity: 0; }
}
.stButton>button {
width: 100%;
height: 60px;
font-size: 20px;
}
</style>
""", unsafe_allow_html=True)
# Page 1: Welcome
if st.session_state.page == 1:
st.markdown("<h1 style='text-align: center;'>Hello Good Mornaftvening ππ</h1>", unsafe_allow_html=True)
st.markdown("<h2 style='text-align: center;'>WELCOME TO MALUS QUIZ ππ₯°</h2>", unsafe_allow_html=True)
st.markdown("<br><br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("NEXT β‘οΈ", key="page1_next"):
st.session_state.page = 2
st.rerun()
# Page 2: Duvilme slider
elif st.session_state.page == 2:
st.markdown("<h1 style='text-align: center;'>Hooooooow much duvilme?ππ</h1>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
slider_value = st.slider("", 1, 100, st.session_state.slider_value, key="duvilme_slider")
st.session_state.slider_value = slider_value
st.markdown(f"<h2 style='text-align: center;'>{slider_value}</h2>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("SUBMIT π", key="page2_submit"):
if slider_value != 100:
st.error("error 404 not foundβ οΈβ οΈ π¦₯")
time.sleep(1)
else:
st.session_state.page = 3
st.rerun()
# Page 3: Celebration
elif st.session_state.page == 3:
st.balloons()
st.markdown("<h1 style='text-align: center;'>yay kissie bullets upcoming πππ</h1>", unsafe_allow_html=True)
# Display 100 kiss emojis
emoji_grid = "π " * 50
st.markdown(f"<div style='text-align: center; font-size: 20px; line-height: 1.5;'>{emoji_grid}</div>", unsafe_allow_html=True)
st.markdown("<br><br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("CONTINUE β‘οΈ", key="page3_next"):
st.session_state.page = 4
st.rerun()
# Page 4: Qualification
elif st.session_state.page == 4:
st.markdown("<h1 style='text-align: center;'>Hmm good boy pat patπ₯°π₯°</h1>", unsafe_allow_html=True)
st.markdown("<h2 style='text-align: center;'>You're qualified to play the quizπ€</h2>", unsafe_allow_html=True)
st.markdown("<br><br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("START QUIZ π―", key="page4_next"):
st.session_state.page = 5
st.rerun()
# Page 5: Question 1
elif st.session_state.page == 5:
st.markdown("<h2 style='text-align: center;'>What is malus favourite snacks π₯π?</h2>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
answer = st.radio("Choose one:",
["a. Dubu lips fry", "b. Dubi face omlette", "c. Dubdu cheek pastry"],
key="q1_radio")
st.markdown("<br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("NEXT β‘οΈ", key="page5_next"):
st.session_state.answers['q1'] = answer[0]
st.session_state.page = 6
st.rerun()
# Page 6: Question 2
elif st.session_state.page == 6:
st.markdown("<h2 style='text-align: center;'>What is malus fav thing to do?ππ</h2>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
answer = st.radio("Choose one:",
["a. Irritate dudu", "b. Irritaaaaaaaaate dudu", "c. Irritateeeeeeeeee dudu"],
key="q2_radio")
st.markdown("<br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("NEXT β‘οΈ", key="page6_next"):
st.session_state.answers['q2'] = answer[0]
st.session_state.page = 7
st.rerun()
# Page 7: Question 3
elif st.session_state.page == 7:
st.markdown("<h2 style='text-align: center;'>Why do u always think about me?ππ</h2>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
answer = st.radio("Choose one:",
["a. Cus duvilme", "b. Cus ivillums", "c. Cus ily", "d. Cus ylm"],
key="q3_radio")
st.markdown("<br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("NEXT β‘οΈ", key="page7_next"):
st.session_state.answers['q3'] = answer[0]
st.session_state.page = 8
st.rerun()
# Page 8: Question 4
elif st.session_state.page == 8:
st.markdown("<h2 style='text-align: center;'>Choose the best optionππ</h2>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
answer = st.radio("Choose one:",
["a. Dubis is cuteπ", "b. Dubis is cuterπ", "c. Dubis is cuttestπ"],
key="q4_radio")
st.markdown("<br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("SEE RESULTS π", key="page8_next"):
st.session_state.answers['q4'] = answer[0]
# Calculate score
score = 0
for q, ans in st.session_state.answers.items():
if ans == correct_answers[q]:
score += 1
st.session_state.score = score
st.session_state.page = 9
st.rerun()
# Page 9: Score Display
elif st.session_state.page == 9:
st.markdown("<h2 style='text-align: center;'>Your score isππ</h2>", unsafe_allow_html=True)
st.markdown(f"<h1 style='text-align: center; font-size: 60px;'>{st.session_state.score}/4</h1>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
score = st.session_state.score
if score == 1:
st.markdown("<h2 style='text-align: center;'>I hate you *1π</h2>", unsafe_allow_html=True)
elif score == 2:
st.markdown("<h2 style='text-align: center;'>I hate you * 2ππ</h2>", unsafe_allow_html=True)
elif score == 3:
st.markdown("<h2 style='text-align: center;'>woww π</h2>", unsafe_allow_html=True)
elif score == 4:
st.markdown("<h2 style='text-align: center;'>Superrrrrππππππ</h2>", unsafe_allow_html=True)
st.markdown("<br><br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("CONTINUE β‘οΈ", key="page9_next"):
st.session_state.page = 10
st.rerun()
# Page 10: Valentine Proposal
elif st.session_state.page == 10:
st.markdown("<h1 style='text-align: center;'>Will u be my valentine π?ππ</h1>", unsafe_allow_html=True)
st.markdown("<h2 style='text-align: center;'>Ik you will -ππ</h2>", unsafe_allow_html=True)
st.markdown("<br><br>", unsafe_allow_html=True)
# Show error message if they clicked NO before
if st.session_state.get('no_clicked', False):
st.markdown("<h2 style='text-align: center; color: #FF4444;'>Ivanethaaa ππ</h2>", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
# Two buttons side by side
col1, col2 = st.columns(2)
with col1:
if st.button("β NO", key="page10_no"):
st.session_state.no_clicked = True
st.rerun()
with col2:
if st.button("π YES!", key="page10_yes"):
st.session_state.page = 11
st.session_state.no_clicked = False # Reset the flag
st.rerun()
# Page 11: Final Message
elif st.session_state.page == 11:
st.balloons()
st.markdown("<h1 style='text-align: center; color: #FF1493;'>π Advanced Happy Birthday π</h1>", unsafe_allow_html=True)
st.markdown("<h2 style='text-align: center;'>πππβ€οΈ I LOVE YOU β€οΈππ₯³</h2>", unsafe_allow_html=True)
# Display party emojis
party_emojis = "πππππ₯³" * 10
st.markdown(f"<div style='text-align: center; font-size: 30px; line-height: 1.5;'>{party_emojis}</div>", unsafe_allow_html=True)
st.markdown("<br><br>", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
if st.button("RESTART π", key="restart"):
st.session_state.page = 1
st.session_state.score = 0
st.session_state.answers = {}
st.session_state.slider_value = 50
st.rerun()