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("Who is the greatest basketball player of all time?")
if rsp == "Lebron James":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("Who is the greatest soccer player of all time")
if rsp == "Ronaldo":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("What is the best NBA franchise of all time?")
if rsp == "Cavaliers":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))
Hello, timal-faraje running /opt/homebrew/opt/python@3.11/bin/python3.11
You will be asked 3 questions.
Question: Are you ready to take a test?
Question: Who is the greatest basketball player of all time?
Lebron James is correct!
Question: Who is the greatest soccer player of all time
Ronaldo is correct!
Question: What is the best NBA franchise of all time?
Cavaliers is correct!
timal-faraje you scored 3/3