import random

quiz_questions = [
    {
        "question": "What is the capital of France?",
        "choices": ["Paris", "London", "Berlin", "Madrid"],
        "correct_answer": "Paris"
    },
    {
        "question": "Which planet is known as the Red Planet?",
        "choices": ["Earth", "Mars", "Venus", "Jupiter"],
        "correct_answer": "Mars"
    },
    {
        "question": "What is the light that passes through glass without breaking it?",
        "choices": ["The light", "The sound", "Water", "Pin"],
        "correct_answer": "The light"
    },
    {
        "question": "The son of water, but if he is placed in it, he dies?",
        "choices": ["The juice", "The sea", "The snow", "The Water"],
        "correct_answer": "The snow"
    },
    {
        "question": "What is the fastest fish ever?",
        "choices": ["whale", "shark", "crab", "Tuna"],
        "correct_answer": "Tuna"
    },
]

def ask_question(question_data):
    print(question_data["question"])
    for i, choice in enumerate(question_data["choices"], start=1):
        print(f"{i}. {choice}")
    player_answer = input("Enter the number corresponding to your answer: ")
    return player_answer

def main():
    num_questions = 5 
    score = 0

    random.shuffle(quiz_questions)
    for i in range(num_questions):
        print(f"\nQuestion {i + 1}:")
        player_answer = ask_question(quiz_questions[i])
        correct_answer = quiz_questions[i]["correct_answer"]

        if player_answer.isdigit() and 1 <= int(player_answer) <= len(quiz_questions[i]["choices"]):
            player_choice = quiz_questions[i]["choices"][int(player_answer) - 1]
            if player_choice == correct_answer:
                print("Correct! 🎉")
                score += 1
            else:
                print(f"Sorry, the correct answer was {correct_answer}.")
        else:
            print("Invalid input. Please enter a valid choice.")

    print(f"\nQuiz completed! Your score: {score}/{num_questions}")

if __name__ == "__main__":
    main()
