My Quiz
This quiz is about me! It has a special option so make sure to think outside of the box ;)
def question_with_response(promt):
print("Question: " + promt)
msg = input()
return msg
correct = 0
ec_abort = 0
# I created the variable "ec_abort" (stands for extra credit abort)
print("Hey queen, make sure to think out of the box when taking this quiz.")
print("You will be asked 5 questions about me. Make sure the first letter of your answer is capitalized and that if it is numerical, use the number.")
question_with_response("Are you ready?")
if ec_abort == 0:
rsp = question_with_response("How old am I?")
if rsp == "16":
print(rsp + " is correct:)")
correct += 1
elif rsp == "Give me 100%":
print(rsp + " BOOM 100% YOU ARE DONE")
ec_abort = 1
else:
print(rsp + " is no bueno:(")
# The new variable allows me to code so that if the user of my quiz types "Give me 100%", it skips to the end with a 5/5
if ec_abort == 0:
rsp = question_with_response("What is my favorite color?")
if rsp == "Blue":
print(rsp + " is correct:)")
correct +=1
elif rsp == "Give me 100%":
print(rsp + " BOOM 100% YOU ARE DONE")
ec_abort = 1
else:
print(rsp + " is no bueno:(")
# If they get the question correct, then the variable "correct" goes up by 1
if ec_abort == 0:
rsp = question_with_response("How many siblings to I have?")
if rsp == "3":
print(rsp + " is correct:)")
correct +=1
elif rsp == "Give me 100%":
print(rsp + " BOOM 100% YOU ARE DONE")
ec_abort = 1
else:
print(rsp + " is no bueno:(")
# If their answer is incorrect, the amount correct stays the same and it prints "is no bueno:("
if ec_abort == 0:
rsp = question_with_response("What pet do I have?")
if rsp == "A dog":
print(rsp + " is correct:)")
correct +=1
elif rsp == "Give me 100%":
print(rsp + " BOOM 100% YOU ARE DONE")
ec_abort = 1
else:
print(rsp + " is no bueno:(")
if ec_abort == 0:
rsp = question_with_response("What is my favorite subject?")
if rsp == "Math":
print(rsp + " is correct:)")
correct +=1
elif rsp == "Give me 100%":
print(rsp + " BOOM 100% YOU ARE DONE")
ec_abort = 1
else:
print(rsp + " is no bueno:(")
if ec_abort == 1:
print("You scored 5/5")
if ec_abort == 0:
print ("Slayyy you scored " + str(correct) + "/5")
# If they don't use the "Give me 100%" option, ec_abort is still 0, allowing this step that gives the perentage correct to show