Alternative ways to compute an average

Screen Link:
https://app.dataquest.io/m/312/lists-and-for-loops/11/alternative-way-to-compute-an-average

My Code:

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

all_ratings = []

for row in apps_data[1:]:
    rating = float(row[7])
    all_ratings.append(rating)

avg_rating = sum(all_ratings) / len(all_ratings)

print(all_ratings)```

What I expected to happen:
Code runs properly

What actually happened: 

TypeErrorTraceback (most recent call last)
in ()
10 all_ratings.append(rating)
11
—> 12 avg_rating = sum(all_ratings) / len(all_ratings)
13
14 print(all_ratings)

TypeError: ‘float’ object is not callable


Can someone please help me?
Thanks.
2 Likes

I tried running your code and it ran without error for me. So, might have been a temporary issue/glitch at that time. Unless the code you shared here is not the exact code you tried running.

Try to refresh the page and run it again and hopefully it runs fine now.

2 Likes