The answer use dictionary key while I use the dictionary value and still get the same result

Screen Link: Learn data science with Python and R projects

My Code:
android_clean =
already_added =
for row in android:
name = row[0]
n_reviews = float(row[3])

if (reviews_max[name] == n_reviews) and (name not in already_added):
    android_clean.append(n_reviews)
    already_added.append(name)

print(android_clean[:4])
print(len(android_clean))

I see the answer it’s “android_clean.append(row)” while my code is “android_clean.append(n_reviews)” and it still get correct result. From what I understand, list android_clean is to add the highest amount of reviews, so it should be “android_clean.append(n_reviews)”, isn’t it?

Best,

It’s a little difficult to say without more of your code for context but there is a significant difference between android_clean.append(row) and android_clean.append(n_reviews) since n_reviews is just one value from row. Specifically, n_reviews = float(row[3]).

The instructions for this page says:

  • Append the entire row to the android_clean list (which will eventually be a list of list and store our cleaned data set).

Therefore, we want to use android_clean.append(row) because this will append the entire row and not just the number of reviews.