Python Vocab Quiz
Python term quiz made using Python to quiz knowledge on Python
score = 0
questions = 4
def q_a(q, a):
answer = input(q)
score = 0
if answer == a:
print("Good job! That is correct!")
score = 1
else:
print("Nice try! The answer is " + a + ".")
return score
#intro:
name = input("Enter your name:")
print("Hey! " + name)
ready = input("This quiz will have " + str(questions) + " questions that will test your abilities to identify python terms. Are you ready to start this quiz? Answer yes or no.")
if ready == "yes":
print("Let's get started!")
else:
print("YOU GOT THIS!")
#question 1:
score = score + q_a("Question 1: What term defines a function or method?", "def")
#question 2:
score = score + q_a("Question 2: What is a series of characters?", "string")
#question 3:
score = score + q_a("Question 3: What input prints specified messages on the screen?", "print")
#question 4:
score = score + q_a("Question 4: What is a value that is either true or false?", "boolean")
#ending score
if score >= 3:
print("Congratulations! You completed this quiz with an amazing score! You scored a: {}/4" .format(score))
else:
print("Congratulations! You completed the quiz. Your score is a: {}/4" .format(score))