List and For Loops - Step9 - Validation failure

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]

app_data_set = [row_1, row_2, row_3, row_4, row_5]

rating_sum = 0

for value in app_data_set:
    rating = value[-1]
    rating_sum += rating


avg_rating = rating_sum / len(app_data_set)


The code above works fine and give the expected values of 21.0 for sum and 4.2 for avg_rating.

What happen is when I try to submit my solution it give me the below error, it happened even when I copied the answer exactly

avg_rating isn’t defined in your code, but we expected it to be float type
rating_sum isn’t defined in your code, but we expected it to be float type

 avg_rating ()
- actual + expected

- [undefined]
+ 4.2
 rating_sum ()
- actual + expected

- [undefined]
+ 21
1 Like


Your code looks fine. It even works on the mission’s screen. Try to delete everything in the script and paste this code. If it does not work, I think it may be a case of bug report.


I tried deleting the script and also restoring the code and got the same issue, however the issue went away after I cleared Chrome cache.
Appreciate the help.



1 Like

Hello, I’m also having the same problem with case 9/13
Is there any update solution yet to this problem?

As @aliasalman86 the issue went away after he cleared Chrome cache. You can try that.

If it does not help, it could be error in the code. In this case, you’ll need to post the code so we can help.

Strange, after I restarted my PC, the problem is gone.
Nonetheless, thanks for your respond.