import random #where defs things go def int_check(question): while True: error = "please enter an whole number that is between 1-10 " to_check = input(question) if to_check == "": return "infinite" try: response = int(to_check) # checks that the number is okay if response < 1: print(error) elif response > 10: print(error) else: return response except ValueError: print(error) # Check that users have entered a valid # option based on a list def string_checker(question, valid_ans): 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() # displays instructions 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! ''') def quiz_compare(user_answer, answer): #checks whether the user answer is correct # if computer and user choice are the same if user_answer == answer: question_result = 'Correct' # if user answer is different else: question_result = 'Wrong' return question_result carry_on ="yes" #storing what the questions and answers question_1 = 'What do cats love? ' question_2 = 'Does susie have a tail? ' question_3 = "How many dark worlds have been formed? " question_4 = "what is the queens full serial name? " question_5 = "how many spikes does susie have on her arm bands? " answer_1 = "protein" answer_2 = "yes" answer_3 = "9" answer_4 = "q5u4ex7YY2e9n" answer_5 = "3" question_6 = 'What is the name of Carol Holiday’s song? ' question_7 = 'How much hp does dark candy heal? ' question_8 = 'What is the answer to the first diamond heart spade puzzle from chapter 1? ' question_9 = 'How much hp does rotten tea heal? ' question_10 ='How much hp does susie tea heal noelle? ' answer_6 = 'c' answer_7 = '40' answer_8 = 'spade diamond spade' answer_9 = '10' answer_10 = '400' question_11 = 'Who says: "I Love Tolerating you" ' question_12 = "Who says: 'Oi, Kris, luv! It's me!' " question_13 = "Who says: “Buble” " question_14 = "Who says: “Kris. You walk. With the accursed beast?” " question_15 = "Who says: “And don’t forget me, your eggs-husband!” " answer_11 = "queen" answer_12 = "ramb" answer_13 = "watercooler" answer_14 = "catti" answer_15 = "agsore" question_16 = 'How many different JARONA! Voicelines are there? ' question_17 = 'Who is Yellow in love with? ' question_18 = 'Who is the Roaring Knight? ' question_19 = 'What event is Susie banned from? ' question_20 ="What is Noelle's online username? " answer_16 = '5' answer_17 = 'blue' answer_18 = 'papyrus' answer_19 = 'free ham sandwich day' answer_20 = 'holidaygirl1225' question_21 = 'How many days is ‘How to draw dragons overdue? ' question_22 = 'Is Tenna ever glooby? ' question_23 = "What does the forgotten man say he’ll do on Saturday? " question_24 = "Who is the man who speaks in hands? (full name) " question_25 = "What is Susie's full name? " answer_21 = "2583" answer_22 = "sometimes" answer_23 = "i let it cool on the windowsill" answer_24 = "wing ding gaster" answer_25 = "susie gaster" #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 = [question_6,question_7,question_8,question_9,question_10] answers_2 = [answer_6, answer_7, answer_8, answer_9, answer_10] topic_3 = [question_11,question_12,question_13,question_14,question_15] answers_3 = [answer_11, answer_12, answer_13, answer_14, answer_15] topic_4 = [question_16,question_17,question_18,question_19,question_20] answers_4 = [answer_16, answer_17, answer_18, answer_19, answer_20] topic_5 = [question_21,question_22,question_23,question_24,question_25] answers_5 = [answer_21, answer_22, answer_23, answer_24, answer_25] yes_no = ['yes', 'no'] #main code print("welcome to the deltarune quiz") want_instructions = string_checker("Do you want to see the instructions? ",yes_no) # checks users enter y or n if want_instructions == 'yes': instructions() # the main game loop while carry_on == 'yes': #picks random question and picks the answer that corrospones with question wut_topic_1_question = random.randrange(0, 5) wut_answer_1 = wut_topic_1_question wut_topic_2_question = random.randrange(0, 5) wut_answer_2 = wut_topic_2_question wut_topic_3_question = random.randrange(0, 5) wut_answer_3 = wut_topic_3_question wut_topic_4_question = random.randrange(0, 5) wut_answer_4 = wut_topic_4_question wut_topic_5_question = random.randrange(0, 5) wut_answer_5 = wut_topic_5_question # resetting the varibles wrong = 0 right = 0 #asking the question and then seeing whether they got it right user_answer = input(topic_1[wut_topic_1_question]).lower() answer = answers_1[wut_answer_1] result = quiz_compare(user_answer, answer) print(f'{result}, Your answer: {user_answer}, Answer: {answer} ') # keeping record of whether user gets it right or wrong if result == 'Wrong': wrong+=1 else: right+=1 # asking the question and then seeing whether they got it right user_answer = input(topic_2[wut_topic_2_question]).lower() answer = answers_2[wut_answer_2] result = quiz_compare(user_answer, answer) print(f'{result}, Your answer: {user_answer} Answer: {answer}') if result == 'Wrong': wrong+=1 else: right+=1 # asking the question and then seeing whether they got it right user_answer = input(topic_3[wut_topic_3_question]).lower() answer = answers_3[wut_answer_3] result = quiz_compare(user_answer, answer) print(f'{result}, Your answer: {user_answer} Answer: {answer}') if result == 'Wrong': wrong+=1 else: right+=1 # asking the question and then seeing whether they got it right user_answer = input(topic_4[wut_topic_4_question]).lower() answer = answers_4[wut_answer_4] result = quiz_compare(user_answer, answer) print(f'{result}, Your answer: {user_answer} Answer: {answer}') if result == 'Wrong': wrong+=1 else: right+=1 # asking the question and then seeing whether they got it right user_answer = input(topic_5[wut_topic_5_question]).lower() answer = answers_5[wut_answer_5] result = quiz_compare(user_answer, answer) print(f'{result}, Your answer: {user_answer} Answer: {answer}') if result == 'Wrong': wrong+=1 else: right+=1 #telling the user how much they got right and whether they want to repeat quiz print("you have completed the quiz!") print(f'you got: {right}/5!') carry_on = input("Do you want to try again? (enter yes to continue, press anything else to finish) ") print("please rate this quiz out of 10!") #ask how much they would rate quiz in a range target_score = int_check("what would you rate this quiz between 1-10? ") print('thanks for playing')