Gene's Magnificent Quiz
It is not actually Gene's quiz, it is just a normal quiz.
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)) +"%")