question_and_answer = []
question_and_answer.append({
    "Question": "What is the shape of the earth?",
    "Answer": "sphere"
})

question_and_answer.append({
    "Question": "What is the innermost layer of earth?",
    "Answer": "core"
})

question_and_answer.append({
    "Question": "Is global warming bad?",
    "Answer": "yes"

})

totalquestions = len(question_and_answer)
print("This is a quiz with a total of " + str(totalquestions) + " questions.")

score = 0
for record in question_and_answer:
    msg = input(record["Question"])
    if (msg == record["Answer"]):
         print ("You are correct!")
         score = score + 1
    else:
        print ("Wrong. The correct answer is: " + record["Answer"])

print("Your total score is:" + str(score) + " out of " + str(totalquestions))
This is a quiz with a total of 3 questions.
You are correct!
Wrong. The correct answer is: core
Wrong. The correct answer is: yes
Your total score is:1 out of 3