Jan-29-2020, 09:47 PM
def main_questions(): main_question = input("Would you like to take a short quiz?\n") if main_question == "Yes" or main_question == "yes": print("Lets start!\n") main_quesformat() print("\nThe Answers: 1)A 2)C 3)b\n") raise SystemExit() elif main_question == "No" or main_question == "no": print("Thanks for trying!") raise SystemExit() question_prompts = [ # array "What color are apples?\n(a) Red/Green\n(b) purple\n(c) Orange\n\n", "What color are bananas?\n(a) Teal\n(b) Magenta\n(c) Yellow\n\n", "What color are strawberries?\n(a) Yellow\n(b) Red\n(c) Blue\n\n" ] def main_quesformat(): answer_list = ["a", "c", "b"] answer_choices = ["a", "b", "c"] # The possible answers for single_question in question_prompts: while True: single_answer = input(single_question) if single_answer in answer_choices: # Break the while loop if get a valid answer. break print("Your answer is not in: {}".format(answer_choices)) answer_list.append(single_answer) # Append the correct answer to the return list. return answer_list # Return the all valid answers def answer_score(): main_questions()I am trying to create a function (answer_score) that will take the user imputed answers and calculate what they got out of the three answers. For example it would present: "You got x/3 answers." Having trouble with this. Help?