Math
import getpass, sys
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
questions = 4
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("What is the answer for x? 2x+5=7")
if rsp == "1":
print(rsp + " Your answer is correct")
correct += 1
else:
print(rsp + " Your answer is incorrect")
rsp = question_with_response("What is the shape of function, 6x² + 11x - 35?")
if rsp == "quadratic":
print(rsp + " Your answer is correct")
correct += 1
else:
print(rsp + " Your answer is incorrect")
rsp = question_with_response("What is the y-intercept of this function? y=2x+3")
if rsp == "3":
print(rsp + " Your answer is correct")
correct += 1
else:
print(rsp + " Your answer is incorrect")
rsp = question_with_response("What is the root of this function? y=2(x+3)")
if rsp == "-3":
print(rsp + " Your answer is correct")
correct += 1
else:
print(rsp + " Your answer is incorrect")
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))