I’m at the point where I have to add up the total user reviews for a genre, but I keep getting a divide by zero error for genre_len, which tells me that the ‘if app_genre == genre:’ isn’t resolving the way I need it to.
a_data_freq = freq_table(a_data_free, -5)
for genre in a_data_freq:
total = 0
genre_len = 0
for app in a_data_free:
app_genre = app[-5]
if app_genre == genre:
n_ratings = float(app[5])
total += n_ratings
genre_len += 1
n_ratings_avg = total / genre_len
print(genre, ':', n_ratings_avg)