Quiz Using Python
This Quiz is really hard, make sure to study!
import getpass, sys
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
questions = 3
correct = 0
print('Hello, ' + getpass.getuser() + " running " + sys.executable)
print("You will be asked " + str(questions) + " questions.")
rsp = question_with_response("Is this the first question on the test?")
if rsp == "yes":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
if else == ""
rsp = question_with_response("Is this test hard so far?")
if rsp == "no":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("Is this the best quiz you have taken in your entire life?")
if rsp == "yes":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))