from ast import For
import getpass, sys
from operator import add
from re import A

questions = 3
correct = 0

def question_with_response(prompt):
    print("Question: " + prompt)
    msg = input()
    return msg

def question_answer(Q, A):
    rsp = question_with_response(Q)
    if rsp == (A):
        print(rsp + " is correct")
        return (1)
    else:
        print(rsp + "is incorrect")
        return (0)

print('Hello, ' + getpass.getuser() + " running " + sys.executable)
print("You will be asked " + str(questions) + " questions.")
print("Are you ready to take a test?")

correct += question_answer("What command is used to include other functions that were previously developed?", "import")
correct += question_answer("What command is used to evaluate correct or incorrect response in this example?", "if")
correct += question_answer("Each 'if' command contains an '_________' to determine a true or false condition?", "expression")



print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))

print(getpass.getuser() + " your percentage is " + str(round(correct/questions*100)) +"%")
Hello, nathancapule running /usr/local/opt/python@3.10/bin/python3.10
You will be asked 3 questions.
Are you ready to take a test?
Question: What command is used to include other functions that were previously developed?
import is correct
Question: What command is used to evaluate correct or incorrect response in this example?
if is correct
Question: Each 'if' command contains an '_________' to determine a true or false condition?
ifis incorrect
nathancapule you scored 2/3
nathancapule your percentage is 67%