29 for Henri Matisse instead of 129

Screen Link:

My Code:

def artist_summary(artist_name):
    if artist_name in artist_freq:
        number = artist_freq[artist]
        readout = "There are {num} artworks by {name} in the data set"
        output = readout.format(num = number, name = artist_name)
artist_summary("Henri Matisse")

What I expected to happen:
There are 129 artworks by Henri Matisse in the data set

What actually happened:

There are 29 artworks by Henri Matisse in the data set

The code seemed to work but unfortunately would give me the wrong number for Henri Matisse, even though I have confirmed by printing the value for Henri Matisse in the dictionary is 129

1 Like

It should be artist_freq[artist_name] instead, and not artist_freq[artist].

1 Like

Thank you very much!