import random

# Define a list of questions with their choices and correct answers
questions = [
    {
        "question": "What is the capital of France?",
        "choices": ["A. London", "B. Paris", "C. Berlin", "D. Rome"],
        "answer": "B"
    },
    {
        "question": "Which planet is known as the Red Planet?",
        "choices": ["A. Jupiter", "B. Mars", "C. Venus", "D. Mercury"],
        "answer": "B"
    },
    {
        "question": "What is the powerhouse of the cell?",
        "choices": ["A. Mitochondria", "B. Nucleus", "C. Ribosome", "D. Golgi Apparatus"],
        "answer": "A"
    }
]

def display_question(question):
    print(question["question"])
    for choice in question["choices"]:
        print(choice)

def check_answer(question, answer):
    return answer.lower() == question["answer"].lower()

def main():
    num_questions = 2  # Number of questions to ask
    score = 0

    # Randomly select questions
    selected_questions = random.sample(questions, num_questions)

    # Ask each question
    for question in selected_questions:
        display_question(question)
        user_answer = input("Enter your answer (A, B, C, or D): ")
        if check_answer(question, user_answer):
            print("Correct!")
            score += 1
        else:
            print("Incorrect!")

    # Display final score
    print("Quiz completed! Your score is:", score, "out of", num_questions)

if __name__ == "__main__":
    main()