import random #where defs things go def string_checker(question, valid_ans=("yes", "no")): error = f'please enter a valid option from the following list: {valid_ans}' while True: #get user response and turn it lowercase user_response = input(question).lower() for item in valid_ans: # check if the user response is a word in the list if item == user_response: return item #check if the user response is the same as the first letter of an item in the list elif user_response == item[0]: return item #print error if user not enter correct print(error) print() def instructions(): print(''' This is a quiz about the game deltarune by toby fox. You will be asked 5 questions about the game, make sure that you spell everything correctly, or else you answer may be marked wrong! ''') wut_topic_1_question = random.randrange(0,5) wut_answer_1 = wut_topic_1_question #introduce title of quiz #ask if user wants to see instructions #if y give instructions and continue, if no continue #storing what the questions are question_1 = 'What colour is kris in the dark world? ' question_2 = 'Does susie have a tail? ' question_3 = "what is kris's last name? " question_4 = "what is the queens full serial name? " question_5 = "how many spikes does susie have on her arm bands? " answer_1 = "cyan" answer_2 = "yes" answer_3 = "dremurr" answer_4 = "579y5y393784534342342" answer_5 = "3" #storing the topics and questions topic_1 = [question_1,question_2,question_3,question_4,question_5] answers_1 = [answer_1, answer_2, answer_3, answer_4, answer_5] topic_2 = [1,2,3,4,5] topic_3 = [1,2,3,4,5] topic_4 = [1,2,3,4,5] topic_5 = [1,2,3,4,5] #picking a question question1 = "pick one randomly from topic1" # check whether user answer matches correct answer # inform user whether they got it right or wrong #ask next question #when all questions have been asked and answered caluacte how much they # got out of 5 #tell user their score #ask if they want to end or try it again #if again repeat from picking a question #if end end code #main code/ testing want_instructions = string_checker("Do you want to see the instructions? ") # checks users enter y or n if want_instructions == 'yes': instructions() user_answer = input(topic_1[wut_topic_1_question]) answer = answers_1[wut_answer_1] if user_answer == answer: print(f'Answer:{answer}') print("you got it right") if user_answer != answer: print(f'Answer:{answer}') print("you got it wrong")