I created questions for two subjects (math and history). The append command does this.

import getpass, sys

SubjectList = ["Math", "History"]

QandA = []

# math
QandA.append({
    "What is 10 times 14?": "140", 
    "What is 3 times 8?": "24", 
    "What is 10 divided by 2?": "5",
    "What is 20 times 6?": "120",
    "What is 4 times 15?": "60"
    })

# history
QandA.append({
    "When did the Civil War start?": "1861", 
    "Who was the first president?": "George Washington"
    })

The first loop is for the two subjects, and the second loop is the questions themselves. This code gives the question (key) and checks the answer (value).

def question_with_response(prompt):
    print("Question " + ": " + prompt)
    msg = input()
    return msg

# ask questions and check answers
def for_loop_index():        
    scores = [0 , 0]
    # subject index    
    s = 0    
    for subject in QandA:
        print("\nSubject: " + SubjectList[s])
        for ques, ans in subject.items():        
            #print(ques, ans)
            rsp = question_with_response(ques)
            if rsp == ans:
                print(rsp + " is correct!")
                scores[s] += 1 
            else:
                print(rsp + " is incorrect!")
        # subject index increase
        s += 1
    
    print()
    print("Correct answers in " + SubjectList[0] + ": " + str(scores[0]) + " out of " + str(len(QandA[0])))
    print("Correct answers in " + SubjectList[1] + ": " + str(scores[1]) + " out of " + str(len(QandA[1])))
    return

This code gives a question and answer into the math section at the start with input. Here, the user can make their own question and answer and it will create a new, temporary dictionary that will later be added to the math subject (0).

print("Please add a questions in Math")
newq = input()
print("Please add corresponding answer")
newa = input()
print("You provided " + newq + " and " + newa)

#add new question and answer
temp_dict = {newq: newa}
QandA[0].update(temp_dict)
Please add a questions in Math
Please add corresponding answer
You provided What is 10x6? and 60

This code starts the quiz. It also adds the math question previously created by the user into the quiz. It shows the score at the bottom after all questions are answered.

print('Hello everyone!, ' + getpass.getuser() + " running " + sys.executable)
print("Let's see how smart you are! Ready to take a quiz?")
for_loop_index()
Hello everyone!, nsk1207 running /home/nsk1207/anaconda3/bin/python
Let's see how smart you are! Ready to take a quiz?

Subject: Math
Question : What is 10 times 14?
140 is correct!
Question : What is 3 times 8?
24 is correct!
Question : What is 10 divided by 2?
5 is correct!
Question : What is 20 times 6?
120 is correct!
Question : What is 4 times 15?
50 is incorrect!
Question : What is 10x6?
1861 is incorrect!

Subject: History
Question : When did the Civil War start?
George Washington is incorrect!
Question : Who was the first president?
1861 is incorrect!

Correct answers in Math: 4 out of 6
Correct answers in History: 0 out of 2