Guided Project: android_clean length

Screen Link:

My Code:

android_clean = []
android_already_added = []

for app in google_store_data[1:]:
    name = app[0]
    n_reviews = float(app[3])
    if name not in android_clean and n_reviews == reviews_max[name]:
        android_clean.append(app)
        android_already_added.append(name)

print(len(android_clean))

What I expected to happen:
9659

What actually happened:

10054

Created the android_clean list.
It is longer than the reviews_max{} dictionary. (9659)

Not sure how its possible, given the “not in … and … == …” logic.

TIA!

These are the instructions for that Step -

If n_reviews is the same as the number of maximum reviews of the app name (the number can be found in the reviews_max dictionary) and name is not already in the list already_added (read the solution notebook to find out why we need this supplementary condition):

Your code corresponding to the above -

if name not in android_clean

You are checking for name in android_clean. You are supposed to check for it in android_added (or android_already_added as you have it defined).

Also, for any future questions, please include the Mission link in your post as well. It’s easier to open up the link and have a quick look at it, instead of trying to find the source.

1 Like

@richardkampel I truly conquer with @the_doctor. I also like your explanations because they help someone figure out what they are doing wrong on their own… Bravo( am learning how its done).