import random
from PIL import Image

# Define the artists and their monthly Spotify listeners
artists = {

                    
    '$NOT': {"image":"./fotos/$NOT_1.jpeg", "listeners": 7781046},

    '21 Savage': {"image":"./fotos/21 Savage_1.jpeg", "listeners": 60358167},

    '9lokknine': {"image":"./fotos/9lokknine_1.jpeg", "listeners": 1680245},

    'A Boogie Wit Da Hoodie': {"image":"./fotos/A Boogie Wit Da Hoodie_1.jpeg", "listeners": 18379137},

    'Ayo & Teo': {"image":"./fotos/Ayo & Teo_1.jpeg", "listeners": 1818645},

    

   
}

while True:
    score = 0  # reset score at the beginning of each game
    first_artist, second_artist = random.sample(list(artists.keys()), 2)

    # Load the images for the artists
    first_artist_image = Image.open(artists[first_artist]["image"])
    second_artist_image = Image.open(artists[second_artist]["image"])

    while True:
        # Display the images
        image.show(first_artist_image)
        image.show(second_artist_image)

        guess = input(f"\nWhich artist has more monthly Spotify listeners - 1. {first_artist.title()} or 2. {second_artist.title()}? ")
        guess_lower = guess.strip().lower()

        if guess_lower == 'quit':
            print("Thanks for playing!")
            quit()

        elif guess_lower not in ['1', '2', first_artist.lower(), second_artist.lower()]:
            print("Invalid input. Please enter the name of one of the two artists or 'quit' to end the game.")

        elif guess_lower == first_artist.lower() or guess_lower == '1' and artists[first_artist]["listeners"] > artists[second_artist]["listeners"]:
            print(f"You guessed correctly! {first_artist.title()} had {artists[first_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners and {second_artist.title()} has {artists[second_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners.")
            score += 1
            first_artist, second_artist = random.sample(list(artists.keys()), 2)  # select new artists for the next round

            # Load the images for the new artists
            first_artist_image = Image.open(artists[first_artist]["image"])
            second_artist_image = Image.open(artists[second_artist]["image"])
            continue

        elif guess_lower == second_artist.lower() or guess_lower == '2' and artists[second_artist]["listeners"] > artists[first_artist]["listeners"]:
            print(f"You guessed correctly! {second_artist.title()} had {artists[second_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners and {first_artist.title()} has {artists[first_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners.")
            score += 1
            first_artist, second_artist = random.sample(list(artists.keys()), 2)  # select new artists for the next round

            # Load the images for the new artists
            first_artist_image = Image.open(artists[first_artist]["image"])
            second_artist_image = Image.open(artists[second_artist]["image"])
            continue

        else:
            print(f"\nSorry, you guessed incorrectly. {first_artist.title()} had {artists[first_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners and {second_artist.title()} has {artists[second_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners.\n")
            print(f"Your final score is {score}.")
            play_again = input("Would you like to play again? (y/n) ")
            if play_again.lower() == 'n':
                print("Thanks for playing!")
                quit()
            else:
                score = 0
                first_artist, second_artist = random.sample(list(artists.keys()), 2)  # select new artists for the next round

                # Load the images for the new artists
                first_artist_image = Image.open(artists[first_artist]["image"])
                second_artist_image = Image.open(artists[second_artist]["image"])
                break
why doesnt the game open the images