import random

# Define a list of questions with their corresponding choices and answers
questions = [
    {
        "question": "What is the capital of kingdom of Saudi Arabia?",
        "choices": ["A. Riyadh", "B. Makkah", "C. Taif", "D. Jeddah"],
        "answer": "A"
    },
    {
        "question": "Which planet is known as the Red Planet?",
        "choices": ["A. Venus", "B. Mars", "C. Jupiter", "D. Saturn"],
        "answer": "B"
    },
    {
        "question": "What is the powerhouse of the cell?",
        "choices": ["A. Nucleus", "B. Mitochondria", "C. Ribosome", "D. Cell Membrane"],
        "answer": "B"
    },
    {
        "question": "Who wrote 'Romeo and Juliet'?",
        "choices": ["A. Charles Dickens", "B. William Shakespeare", "C. Jane Austen", "D. Mark Twain"],
        "answer": "B"
    },
    {
        "question": "What is the chemical symbol for water?",
        "choices": ["A. Wo", "B. Wa", "C. H2O", "D. Hy"],
        "answer": "C"
    }
]

def display_question(question):
    print(question["question"])
    for choice in question["choices"]:
        print(choice)

def quiz():
    # Shuffle the questions to get a random selection each time
    random.shuffle(questions)
    
    # Number of questions to ask in each game
    num_questions = 3
    score = 0

    print("Welcome to the Quiz Game!\n")
    for i in range(num_questions):
        print(f"Question {i+1}:")
        display_question(questions[i])
        answer = input("Enter your answer (A, B, C, or D): ").upper()

        # Check if the answer is correct
        if answer == questions[i]["answer"]:
            print("Correct!\n")
            score += 1
        else:
            print(f"Incorrect. The correct answer is {questions[i]['answer']}.\n")

    print(f"Quiz completed! Your score is {score}/{num_questions}.")

if __name__ == "__main__":
    quiz()
