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=("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() # 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 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 = "dreemurr" answer_4 = "579y5y393784534342342" answer_5 = "3" question_6 = 'what is noelles last name? ' question_7 = 'what colour are birdly glasses in the dark world? ' question_8 = 'how many img.friend interactions have there been? ' question_9 = 'who is the roaring knight?' question_10 ='What job did gerson have in the light world? ' answer_6 = 'beans' answer_7 = 'beans' answer_8 = 'beans' answer_9 = 'beans' answer_10 = 'beans' question_11 = 'what colour is kris in the dark world? ' question_12 = 'Does susie have a tail? ' question_13 = "what is kris's last name? " question_14 = "what is the queens full serial name? " question_15 = "how many spikes does susie have on her arm bands? " answer_11 = "cyan" answer_12 = "yes" answer_13 = "dreemurr" answer_14 = "579y5y393784534342342" answer_15 = "3" question_16 = '? ' question_17 = 'dfbeans? ' question_18 = 'sbeans? ' question_19 = 'dffdbeans?' question_20 ='gggbeans? ' answer_16 = 'beans' answer_17 = 'beans' answer_18 = 'beans' answer_19 = 'beans' answer_20 = 'beans' question_21 = 'what colour is kris in the dark world? ' question_22 = 'Does susie have a tail? ' question_23 = "what is kris's last name? " question_24 = "what is the queens full serial name? " question_25 = "how many spikes does susie have on her arm bands? " answer_21 = "cyan" answer_22 = "yes" answer_23 = "dreemurr" answer_24 = "579y5y393784534342342" answer_25 = "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 = [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] question1 = "pick one randomly from topic1" #main code print("welcome to the deltarune quiz") want_instructions = string_checker("Do you want to see the instructions? ") # checks users enter y or n if want_instructions == 'yes': print(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 thye 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} AAAAAAAAAAAAa') # keeping record of wether user gets it right or wrong if result == 'Wrong': wrong+=1 else: right+=1 print(wrong) print(right) # asking the question and then seeing whether thye 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}AAAAAAAAAAAAa') if result == 'Wrong': wrong+=1 else: right+=1 print(wrong) print(right) # asking the question and then seeing whether thye 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}AAAAAAAAAAAAa') if result == 'Wrong': wrong+=1 else: right+=1 # asking the question and then seeing whether thye 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}AAAAAAAAAAAAa') if result == 'Wrong': wrong+=1 else: right+=1 # asking the question and then seeing whether thye 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}AAAAAAAAAAAAa') if result == 'Wrong': wrong+=1 else: right+=1 #telling the user how much they got right and wether 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')