import getpass,sys
# The import command is used to import particular Python modules that involve certain sets of functions and variables that may be useful in a specific script.
def question_answer(prompt):
    print("Question: ")
    message = input("Question: " + prompt)
    print("Answer:" +message)

def response(prompt):
    print("Question: " + prompt)
    message = input("Question: " + prompt) 
    return message   

integer = 3
# Here, what I did was that I defined the value of the integer. This needed to be done for the Bonus question.
question_data = [
    "What type of statement is used to evaluate an expression list?",
    "What type of statement is used to return an expression list?",
    "What type of statement is used to call other Python modules to utilize their functions?",
    "BONUS: What is the name of the Python module used to utilize StackOverflow without leaving the terminal?"
] 

answer_data = [
    "expression",
    "return",
    "import",
    "howdoi",
]

questions = len(question_data)
correct = 0

print('Hey skippy, ' + str(questions) + " questions.")
resp = response("Prepared? Say 'yes' or 'no'.")

if resp == "yes":
    
    print("Let's start.")
    for i in range(len(question_data)):
        resp = response(question_data[i])
        if resp == answer_data[i]:
            print(resp + " is correct.")
            correct +=1
        else:
            print(resp + " is wrong.")
    
    
    print (getpass.getuser() + " you got a " + str(correct) + "/" + str(integer) + " or a " + str((correct / integer) * 100) + "%")

else:
    print("Leave.")
Hey skippy, 4 questions.
Question: Prepared? Say 'yes' or 'no'.
Let's start.
Question: What type of statement is used to evaluate an expression list?
expression is correct.
Question: What type of statement is used to return an expression list?
return is correct.
Question: What type of statement is used to call other Python modules to utilize their functions?
import is correct.
Question: BONUS: What is the name of the Python module used to utilize StackOverflow without leaving the terminal?
howdoi is correct.
vardaan you got a 4/3 or a 133.33333333333331%

Now, I'd like to talk about a caveat that I used in the code. As you can all see, I defined 'integer' as 3 at the start, even though there were 4 questions. This is because the 4th question was defined as a bonus question, and if someone got the bonus question right, they should get more than a 100%.

First, I tried without defining the integer value in the code and just adding the number 3 in the last print statement, but that did not work, as Python cannot concatenate an integer into a string value. Therefore, I had to define the integer as a string, and that made the print statement work without crashing at the end.

Thanks!