Blue Week Special Offer | Brighten your week!

The average rating is not as expected and also the length of the list is shorter than expected

Screen Link:

My Code:

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

games_social_ratings = []
for row in apps_data[1:]:
    rating = float(row[7])
    genre = row[11]
    if genre == 'Socal Networking' or genre == 'Games':
avg_games_social = sum(games_social_ratings) / len(games_social_ratings)

What I expected to happen:
I expected that the code I ran would be equal to the actual average rating.

What actually happened:

avg_games_social is greater than what we expected.
games_social_ratings is shorter than we expected.

Hi there!

I am not sure as to why the output of my code is not what is expected. I even cross-checked it with the solution given by DQ.

If anyone can help, thank you in advance. :slight_smile:

You have a typo in Socal.

1 Like

Oh shoot! Silly me! Thanks doctor!