# Required libraries import streamlit as st import pandas as pd # Reading the CSV file @st.cache_data def load_data(): data = pd.read_csv('questions_working.csv') return data data = load_data() # Filter questions by levels easy_questions = data[data['Level'] == 'Easy'] very_easy_questions = data[data['Level'] == 'Very Easy'] moderate_questions = data[data['Level'] == 'Moderate'] # Create columns for the selection boxes col1, col2, col3, col4 = st.columns(4) # Display selection boxes in columns easy_selection_1 = col1.selectbox('Choose an Easy Question (1):', easy_questions['ID'].tolist()) easy_selection_2 = col2.selectbox('Choose an Easy Question (2):', easy_questions['ID'].tolist()) very_easy_selection = col3.selectbox('Choose a Very Easy Question:', very_easy_questions['ID'].tolist()) moderate_selection = col4.selectbox('Choose a Moderate Question:', moderate_questions['ID'].tolist()) # If button is pressed, display the answers if st.button('Show Answers'): selections = [easy_selection_1, easy_selection_2, very_easy_selection, moderate_selection] for selected_id in selections: question_row = data[data['ID'] == selected_id].iloc[0] st.markdown('---') # Draw a horizontal line st.write(f"**Question (ID: {question_row['ID']}):** {question_row['Question']}") st.write(f"**Answer:** {question_row['Answer']}")