This is a quiz that will go over the basic vocabulary that was covered in the the jupyter document.
correct = 0
#function that takes in the question and the answer, then it determines whether the input is correct or incorrect then changes the variable correct depending on the answer
def question(prompt, answer):
#prints the question
print("Question: " + prompt)
#takes in the input
msg = input()
#checks if the answer is correct or not
if (msg).lower() == answer:
#prints if the message is correct
print(msg + " is correct!")
#changes the correct variable
global correct
correct += 1
#checks to see if its false
else:
#prints out that the answer is false
print(msg + " is incorrect!")
#Questions
questions = [("What function woud you use to output text?","print"), ("What function would you use to take input from the user?","input"), ("What keyword do you use to define a function?", "def"),("what function checks whether or not a certain condition is true or false?", "if")]
for i in questions:
question(i[0] ,i[1])
Percentage = correct/4
print("You got " +str(int(Percentage*100))+"%")