Quiz Details

  • To create this quiz I used the basics like if else from my other quiz
  • Also I added a key and a loop as you can see using the for statement
def question_and_answer(prompt):
    print("Question: " + prompt)
    msg = input()
    print("Answer: " + msg)

quiz = { "How many ounces are in a gallon?", "128",
         "How many quaters are in a dollar?", "4",
         "What is the first letter in the alphabet?","A",
        }

print("Hello welcome to my quiz you will be asked 3 questions?")
    
for key in quiz:
    rsp = question_and_answer(key)
    if rsp == question_and_answer(key):
        print("good job that is correct!")
      
    else: 
        print("sorry that not correct!")

print("At this time you have finished the quiz thank you for your time!")
Hello welcome to my quiz you will be asked 3 questions?
Question: How many quaters are in a dollar?
Answer: 
Question: How many quaters are in a dollar?
Answer: 4
good job that is correct!
Question: 4
Answer: 
Question: 4
Answer: 
good job that is correct!
Question: What is the first letter in the alphabet?
Answer: a
Question: What is the first letter in the alphabet?
Answer: a
good job that is correct!
Question: 128
Answer: 
Question: 128
Answer: 
good job that is correct!
Question: How many ounces are in a gallon?
Answer: 
Question: How many ounces are in a gallon?
Answer: 
good job that is correct!
Question: A
Answer: 
Question: A
Answer: 
good job that is correct!
At this time you have finished the quiz thank you for your time!