name = input("Enter your name: ")
questions = ["What command do you type when you want to output a string of text in python: ", "What keyword would you use to define a function: ",
"If you see many lines of code in order, what would College Board call it: ", "What command is used to include other functions that were previously developed: "]
answers = ["print", "def", "sequence", "import"]
print("> Enter your name: Peyton")
print("Welcome to the quiz,", name, "\n")
def quiz(questions, answers):
score = 0
for i in range(len(questions)):
answer=input(questions[i]+ "\n")
print("> "+ questions[i] + answer)
if answer == answers[i]:
print("Correct!\n")
score += 1
else:
print("Wrong. The correct answer is "+ answers[i] + "\n")
percent= 100 * (score/len(answers))
print("Your score was "+str(percent)+ "%, or "+ str(score)+"/"+str(len(answers)))
quiz(questions, answers)
Python Practice Quiz • 2 min read
Description
This is a simple Python Quiz