QuizBot / helpers /quiz_utils.py
PJamila's picture
Create quiz_utils.py
fa94948
raw
history blame contribute delete
No virus
389 Bytes
import random
import ast
import streamlit as st
def string_to_list(s):
try:
return ast.literal_eval(s)
except (SyntaxError, ValueError) as e:
st.error(f"Error: The provided input is not correctly formatted. {e}")
st.stop()
def get_randomized_options(options):
correct_answer = options[0]
random.shuffle(options)
return options, correct_answer