import getpass, sys
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
questions = 6
correct = 0
print('Hello, ' + getpass.getuser() + " running " + sys.executable)
#This command asks for your name and also introduces you on how to input a message.
print("What is your name?")
msg = input("My name is: ")
print("Hi " + msg)
print("You will be asked " + str(questions) + " questions.")
question_and_answer = ("Are you ready to take a test?")
questionsType = ["1. What command is used to output a message?", "2. What is the word in Python that defines a function?", "3. How do you access vscode through a terminal?", "4. What is your Teacher's name?", "5. What language are we learning?", "6. What period do you have APCSP?"]
answersType = ["print", "def", "code .", "Mr. Yeung", "python", "4"]
#I am using the for loop
for i in range(0, 6):
rsp = question_with_response(questionsType[i])
if rsp == answersType[i]:
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
#This calculates and tells you your score.
print(msg + " you scored " + str(correct) +"/" + str(questions))
Intro to Python Notebook
This is the quiz that I made using the vocabulary from the Jupyter notebook.