Dictionaries And Frequency Tables 9.Proportions and Percentages

Screen Link:
https://app.dataquest.io/m/314/dictionaries-and-frequency-tables/9/proportions-and-percentages

My Code:

opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
genre_counting  = {}

for row in apps_data[1:]:
    genre = row[11]
    if genre in genre_counting:
        genre_counting[genre] += 1
    else:
        genre_counting[genre] = 1
    
print(genre_counting)        

What actually happened:


TypeErrorTraceback (most recent call last)
<ipython-input-1-dc9de78227f6> in <module>()
      2 from csv import reader
      3 read_file = reader(opened_file)
----> 4 apps_data = list(read_file)
      5 genre_counting  = {}
      6 

TypeError: 'list' object is not callable```

genre_counting isn’t defined in your code, but we expected it to be dict type
1 Like

Hi @zuhoor_2003,

Welcome to the community!

This post explains this issue in detail and offers a fix for it:

Let me know if you need any additional help. :slightly_smiling_face:

Best,
Sahil