class Question:
def __init__(self, prompt, answer): # defines variables
self.prompt = prompt
self.answer = answer
# this is my list of questions with question and answer choices
question_prompts = [
"What is a secotion of code that is on top of files with key-values? \n(a)front matter \n(b)variable",
"Is sytac used to format plain text known as Markdown? ?\nyes/\nno",
"Does boolean mean a value is either true or false? \nyes/\nno",
"Is a sequence two or more line of code? \nyes\nno",
]
# answer
questions = [
Question(question_prompts[0], "a"),
Question(question_prompts[1], "yes"),
Question(question_prompts[2], "yes"),
Question(question_prompts[3], "yes"),
]
# 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)