An NBA Quiz For You!
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.")
question_with_response("Are you ready to take a test?")
rsp = question_with_response("How many rings did Michael Jordan win in his NBA career?")
if rsp == "6":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("How many teams has Lebron James played for in his lifetime?")
if rsp == "3":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("In what year did the Cavs make a 3-1 comeback in the finals?")
if rsp == "2016":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
print(getpass.getuser() + " you scored " + str(correct) + "/" + str(questions) + " for a score of " + str((correct/questions)*100) + "%" )