import random

# Define the artists and monthly Spotify listeners by genre
artists_by_genre = {
    ' (1) Hip-Hop': {
        '21 Savage': 60358167,
        'A Boogie Wit Da Hoodie': 18379137,
        '$NOT': 7781046,
        '9lokknine': 1680245,
        'Ayo & Teo': 1818645
    },
    ' (2) Pop': {
        'Ariana Grande': 81583006,
        'Dua Lipa': 35650224,
        'Ed Sheeran': 66717265,
        'Justin Bieber': 46540612,
        'Lady Gaga': 24622751
    }
}

while True:
    score = 0
    genre = input("Which music genre do you want to play with?  (1) Hip-Hop or (2) Pop ")
    if genre not in ['1', '2']:
        print("Invalid genre. Please choose Hip-Hop, Pop,")
        continue

    artists_listeners = artists_by_genre[f" ({genre}) {'Hip-Hop' if genre == '1' else 'Pop'}"]
    artist_names = list(artists_listeners.keys())

    while True:
        first_artist, second_artist = random.sample(artist_names, 2)
        guess = input(f"\nWhich artist has more monthly Spotify listeners - 1. {first_artist} or 2. {second_artist}? ")
        guess_lower = guess.strip().lower()

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

        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, '1' or '2', or 'quit' to end the game.")
            continue

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

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

        else:
            print(
                f"\nSorry, you guessed incorrectly. {first_artist} had {artists_listeners[first_artist] / 1e6:.1f}M monthly Spotify listeners and {second_artist} has {artists_listeners[second_artist] / 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!")
                break
            else:
                score = 0
                first_artist, second_artist = random.sample(list(artists_listeners.keys()),
                                                            2)  # select new artists for the next round
                continue

why does the game ask which genre you want to play after saying you dont want to play again