Unexpected TypeError

Screen Link:


My Code:

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

all_ratings = []
for each_row in apps_data[1:]:
    rating = float(each_row[7])

avg_rating = sum(all_ratings) / len(all_ratings)

What I expected to happen:

Run properly

What actually happened:

TypeErrorTraceback (most recent call last)
<ipython-input-1-4e003632f9ff> in <module>()
      9     all_ratings.append(rating)
---> 11 avg_rating = sum(all_ratings) / len(all_ratings)
     12 print(avg_rating)

TypeError: 'int' object is not callable

Can someone please explain to me what I did wrong here? When I copied and pasted in the correct answer, the code ran properly, even though my own code is identical to the given answer. Thanks!

I tested your code, and it runs fine. Might have been some temporary issue or glitch. Refresh the page and try again.

Hello @gabriellee02, welcome to the community!

Check out this post - TypeError: 'x' object is not callable