In: Computer Science
Please make the following modifications to the following code:
# A simple program that gives the user a quiz and gives them a score after
#By Abi Santo
#9/27/20
def main():
    print("This Program gives you a quiz and a score after you are done with the quiz")
    quiz_set = [{
        "type" : "single_answer",
        "question" : "What State is Seattle located in?",
        "answer" : "Washington"},
                {
        "type" : "single_answer",
        "question" : "Who is the Speaker of the House?",
        "answer" : "Nancy Pelosi"},
                {
        "type" : "single_answer",
        "question" : "What is the Capital of the United Kingdon?",
        "answer" : "London"},
                {
        "type" : "multiple_choice",
        "question" : "What is the Capital of The United States?",
        "answer" : "c",
        "choices" : "a. New York City \n b. Los Angeles \n c. Washington DC \n d. Chicago"},
                {
        "type" : "multiple_choice",
        "question" : "Who is the President of the United States?",
        "answer" : "a",
        "choices" : "a. Donald Trump \n b. Tim Cook \n c. Barack Obama \n d. Bill Gates"},
                 ]
    score = 0
    for i in range(5):
        print("Question "+str(i+1)+": ")
        print(quiz_set[i]["question"])
        if(quiz_set[i]["type"] == "single_answer"):
            ans = input("Enter Answer ")
            if(ans.lower() == quiz_set[i]["answer"].lower()):
                score +=1
                print("Correct")
            else:
                print("Incorrect")
        elif(quiz_set[i]["type"] == "multiple_choice"):
            print("Options:\n", quiz_set[i]["choices"])
            ans = input("Enter correct choice: ")
            if(ans.lower() == quiz_set[i]["answer"].lower()):
                score +=1
                print("Correct")
            else:
                print("Incorrect")
    if(score >= 0 and score <= 2):
        print("Better luck next time.")
    elif(score >= 3 and score <= 4):
        print("Not bad. Try again soon!")
    else:
        print("You Rock")
    print("Thank you for playing!")
    input("Press the <Enter> key to quit.")
main()
OUTPUT:

CODE:
def main():
print("This Program gives you a quiz and a score after you are done with the quiz")
quiz_set = [{
"type" : "single_answer",
"question" : "What State is Seattle located in?",
"answer" : "Washington"},
{
"type" : "single_answer",
"question" : "Who is the Speaker of the House?",
"answer" : "Nancy Pelosi"},
{
"type" : "single_answer",
"question" : "What is the Capital of the United Kingdon?",
"answer" : "London"},
{
"type" : "multiple_choice",
"question" : "What is the Capital of The United States?",
"answer" : "c",
"choices" : "a. New York City \n b. Los Angeles \n c. Washington DC \n d. Chicago"},
{
"type" : "multiple_choice",
"question" : "Who is the President of the United States?",
"answer" : "a",
"choices" : "a. Donald Trump \n b. Tim Cook \n c. Barack Obama \n d. Bill Gates"},
]
score = 0
playagain = True
while playagain:
for i in range(5):
isSkip = False
isIncorrect = True
while not isSkip and isIncorrect:
print("Question "+str(i+1)+": ")
print(quiz_set[i]["question"])
if(quiz_set[i]["type"] == "single_answer"):
ans = input("Enter Answer ")
if(ans.lower() == quiz_set[i]["answer"].lower()):
isIncorrect = False
print("Correct")
else:
if ans == 'skip':
isSkip = True
else:
print("sorry, try again")
elif(quiz_set[i]["type"] == "multiple_choice"):
print("Options:\n", quiz_set[i]["choices"])
ans = input("Enter correct choice: ")
if(ans.lower() == quiz_set[i]["answer"].lower()):
isIncorrect = False
print("Correct")
else:
if ans == 'skip':
isSkip = True
else:
print("sorry, try again")
op = input('Do you want to play again')
if op == 'yes':
playagain = True
else:
playagain = False
print("Thank you for playing!")
input("Press the <Enter> key to quit.")
main()