import random

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

while True:
    score = 0  # reset score at the beginning of each game
    genre = input("Which music genre do you want to play with? (1) Hip-Hop or (2) Pop ")
    if str(genre) not in artists_by_genre and str(genre) not in ['1', '2']:
        print("Invalid genre. Please choose Hip-Hop, Pop, 1, or 2.")
        continue

    artists_listeners = artists_by_genre[str(genre)]
    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 or 'quit' to end the game.")

        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

why do i get this error : 

C:\Users\elias\PycharmProjects\pythonProject\venv\Scripts\python.exe C:\Users\elias\PycharmProjects\pythonProject\main.py 
Which music genre do you want to play with? (1) Hip-Hop or (2) Pop 2
Traceback (most recent call last):
  File "C:\Users\elias\PycharmProjects\pythonProject\main.py", line 28, in <module>
    artists_listeners = artists_by_genre[str(genre)]
                        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: '2'

Process finished with exit code 1