Python Quiz
Try your luck in this NBA themed quiz!
import getpass, sys
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
questions = 4
correct = 0
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
rsp = question_with_response("Bill Russel has won the most NBA championships in history. How many championships has he won?")
if rsp == "11":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("What was the last year that the Sacramento Kings made the playoffs?")
if rsp == "2006":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("Which player holds the record for the most points in a single game?")
if rsp == "Wilt Chamberlain":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("Which NBA player holds the all-time record for the most total assists?")
if rsp == "John Stockton":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))