class Question:
def __init__(self, prompt, answer): # Defines variables
self.prompt = prompt
self.answer = answer
# This is my list of questions with questions and answer choices
question_prompts = [
"How many lines are in a sequence of code? \n(a)2 or more \n(b)1",
"Does (base) come from Anaconda?\nyes/\nno",
"Are we in APCSP? \nyes/\nno",
"What grade do you want in this class? (C)\n(A)\n(B)\n(A+)",
]
# Answers
questions = [
Question(question_prompts[0], "a"),
Question(question_prompts[1], "yes"),
Question(question_prompts[2], "yes"),
Question(question_prompts[3], "A+"),
]
# Prints score (correct answer = score + 1)
def run_quiz(questions):
score = 0
for question in questions:
answer = input(question.prompt)
if answer == question.answer:
score += 1
print("you got", score, "out of", len(questions))
run_quiz(questions)
#_____/\\\\\\\\\_____/\\\\\\\\\\\\\__________/\\\\\\\\\_____/\\\\\\\\\\\____/\\\\\\\\\\\\\___
# ___/\\\\\\\\\\\\\__\/\\\/////////\\\_____/\\\////////____/\\\/////////\\\_\/\\\/////////\\\_
# __/\\\/////////\\\_\/\\\_______\/\\\___/\\\/____________\//\\\______\///__\/\\\_______\/\\\_
# _\/\\\_______\/\\\_\/\\\\\\\\\\\\\/___/\\\_______________\////\\\_________\/\\\\\\\\\\\\\/__
# _\/\\\\\\\\\\\\\\\_\/\\\/////////____\/\\\__________________\////\\\______\/\\\/////////____
# _\/\\\/////////\\\_\/\\\_____________\//\\\____________________\////\\\___\/\\\_____________
# _\/\\\_______\/\\\_\/\\\______________\///\\\___________/\\\______\//\\\__\/\\\_____________
# _\/\\\_______\/\\\_\/\\\________________\////\\\\\\\\\_\///\\\\\\\\\\\/___\/\\\_____________
# _\///________\///__\///____________________\/////////____\///////////_____\///______________