Lists, for loop av-ratings

Screen Link:

My Code:
app_data_set = [row_1, row_2, row_3, row_4, row_5]
rating_sum = 0
a=0
for row in app_data_set:
rating_sum =rating_sum+app_data_set[a][-1]
a+=1
print(rating_sum)
avg_rating = rating_sum/len(app_data_set)
print(avg_rating)

Replace this line with your code

What I expected to happen:
My code was accepted but with a different method
I started off with a=0 outside the loop and then a+=1
The value of ‘a’ could go on forever. I was expecting the code not to be accepted or was I lucky?

What actually happened:

Replace this line with the output/error

@becon12 If I understood your question, you are wondering why your solution was accepted yet you expected it to be wrong and for a to go on forever?
If that’s the case, the “answer checker” checks only for the value of avg_rating and the answer is accepted if your value matches the expected value, despite the method you use. Going through your code, it is expected to print out the correct value so that’s why it was accepted. The variable a does not go on forever because it is inside a loop which terminates after five iterations(the length of app_data_set)

Thank you.Much appreciated