Lists and For Loops Average Error

Screen Link:
https://app.dataquest.io/m/312/lists-and-for-loops/4/retrieving-multiple-list-elements

My Code:

row_1 = ['Facebook', 0.0, 'USD', 2974676, 3.5]
row_2 = ['Instagram', 0.0, 'USD', 2161558, 4.5]
row_3 = ['Clash of Clans', 0.0, 'USD', 2130805, 4.5]
row_4 = ['Temple Run', 0.0, 'USD', 1724546, 4.5]
row_5 = ['Pandora - Music & Radio', 0.0, 'USD', 1126879, 4.0]
fb_rating_data = [row_1[0], row_1[-2], row_1[-1]]
print(fb_rating_data)
insta_rating_data = [row_2[0], row_2[3], row_2[-1]]
print(insta_rating_data)
pandora_rating_data  = [row_5[0], row_5[-2], row_4[-1]]
print(pandora_rating_data)
avg_rating = (fb_rating_data[2] + insta_rating_data[2] + pandora_rating_data[2])/ 3
print(avg_rating)

What I expected to happen:
The actual answer should be (3.5 +4.5+4.5) / 3
Answer is 4.166666

What actually happened:
avg_rating is greater than what we expected.
``
Paste output/error here
Output
[‘Facebook’, 2974676, 3.5]
[‘Instagram’, 2161558, 4.5]
[‘Pandora - Music & Radio’, 1126879, 4.5]
4.166666666666667

The average value should be 4.16. If not please, provide the detailed explanation to me.

I could be wrong but I think it’s because you may be grabbing the incorrect pandora rating? The last item is row_4 instead of row_5 making your selection the Temple Run rating.

2 Likes