import getpass, sys

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

def evaluate_answer(answer, response, correct):
    if response == answer:
      print(response + " is correct!")
      correct += 1
    else:
      print(response + " is incorrect!")
    return correct
    


questions = 3
correct = 0

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

rsp = question_with_response("Which key word in Python is used to define a function?")
correct = evaluate_answer("def", rsp, correct)
print(correct)

rsp = question_with_response("What is a synonym for a procedure?")
correct = evaluate_answer("function", rsp, correct)
print(correct)


rsp = question_with_response("What do two or more lines of code form?")
correct = evaluate_answer("sequence", rsp, correct)
print(correct)

print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))
Hello, SreejaGangapuram running /usr/local/bin/python3
You will be asked 3 questions.
Question: Are you ready to take a test?
Answer: yes
Question: Which key word in Python is used to define a function?
def is correct!
1
Question: What is a synonym for a procedure?
function is correct!
2
Question: What do two or more lines of code form?
sequence is correct!
3
SreejaGangapuram you scored 3/3