# Why is this the solution?

I have a short question to the above Mission. I think it is not necessary to post my Code because it is a question of theory. To calculate the average we take this here:

`avg_rating = rating_sum / len(apps_data[1:])`

But i think it makes more sense to divide with the number of ratings? I want to take the number of ratings and not the number of Apps for dividing. So why did we use the lenght of th whole Dataset to calculate the average? I tried it with len(rating) and len(rating_sum) but it runs on an error. This guided me to try it this way:

1. Divide the rating sum (stored in `rating_sum`) by the number of ratings to get an average value. Store the result in a variable named `avg_rating`.

So from my understanding the number of ratings is not the length of the whole Dataset AppleStore.csv.

Thanks for any input and clarifying, maybe i’m simply wrong with my way of thinking in this Mission Simo

Because each row in the dataset has a rating column. So, the total number of ratings is the same as the total number of rows (excluding the header).

That’s because there is no variable `rating` defined in the code to be able to return its length, and `rating_sum` stores a float value and you can’t have the length for a float value as it’s just one number. `len()` is a valid method for data types/containers like lists.

1 Like

Hi @the_doctor i got it. Thanks for the explanation .

1 Like

I Have a question regarding the average rating for the retrieving multiple lists elements example

I am not understanding this: avg_rating = (fb_rating_data + insta_rating_data + pandora_rating_data) / 3

I know where the 3 Is coming from , but the 2 within the rating is not making sense. Can you possibly explain?

1 Like

Hi @acheiltac7 and welcome to the community!

Since your issue seems to be different than the one mentioned in the original post, I would suggest creating a new topic and be sure to include:

• a link to the mission screen you’re working on
• any code you’re using enclosed in triple backticks (```)

For more on how to ask technical questions in the community, check out this link.

That said and without any context, the `2` is an index for accessing the data stored in each object. With more context, I could probably explain it a little better.

1 Like