“TypeError: 'list' object is not callable”c

under “Dictionaries and Frequency tables”/ “8. Finding the unique values”, I cannot run the pre-provided code; it returns the error: “TypeError: ‘list’ object is not callable”.

Screen Link: Learn data science with Python and R projects

My Code:

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

content_ratings = {}
for list in apps_data[1:]:
   c_rating = list[10]
   if c_rating not in content_ratings:
       content_ratings[c_rating] = 1
       content_ratings[c_rating] += 1

What actually happened:

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

TypeError: 'list' object is not callable

Other details:
I am not sure what I have done wrong… although on the previous slide “7. Counting with dictionaries”, I actually submitted the answer for “8. Finding the unique values”. As I had learnt the technique already, I applied it one slide earlier in 7. Perhaps this is what is causing the problem? I haven’t been unable to undo the error.

Wondering if you could please advise how to proceed?

Hey @rwon4926!

Check out this post and see if it helps:


Hi Mary,
Thank you so much for the redirection! It solved my problem.

I had used list as a name for a variable, and so, this overrode the default list() function. This change was made to the global scope, and stayed even when i reloaded my kernel.

To fix this, I used ‘’‘del list’’’, which restored the original list() function.

1 Like