I do not understand this answer, may someone help?
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]
insta_rating_data = row_2[0]
pandora_rating_data = row_5[0]
row_1[0] = row_1[4]
row_2[0] = row_2[4]
row_5[0] = row_5[4]
avg_rating = (row_1[0] + row_2[0] + row_5[0])/3
What the system expected to happen:
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[3], row_1[-1]]
insta_rating_data = [row_2[0], row_2[3], row_2[4]]
pandora_rating_data = [row_5[0], row_5[3], row_5[4]]
avg_rating = (fb_rating_data[2] + insta_rating_data[2] + pandora_rating_data[2]) / 3
Instructions: For Facebook, Instagram, and Pandora — Music & Radio, isolate the rating data in separate lists. Each list should contain the name of the app, the rating count, and the user rating. Don’t forget that indexing starts at 0.
For Facebook, assign the list to a variable named fb_rating_data.
For Instagram, assign the list to a variable named insta_rating_data.
For Pandora — Music & Radio, assign the list to a variable named pandora_rating_data.
Compute the average user rating for Facebook, Instagram, and Pandora — Music & Radio using the data you stored in fb_rating_data, insta_rating_data, and pandora_rating_data.
You’ll need to add the ratings together first, and then divide the total by the number of ratings.
Assign the result to a variable named avg_rating.
As a side note, we could calculate the average rating here a little bit better using the weighted mean — we’ll learn about the weighted mean in the statistics courses.