Project 1:duplicate entries

I am following the steps to find the number of duplicated and printing a list of example of the duplicates for the android apps, I tried to do the same for the ios app.

for track_name in ios:
if name in unique_apps:

print(‘Number of duplicate apps:’, len(duplicate_apps))
print(‘Examples of duplicate apps:’, duplicate_apps[:5])

Here are the results I got:

Number of duplicate apps: 1511
I am not getting a return on the 'Examples of duplicate apps’

I would like to know:
-did I correctly run the first part of my command: do we really have 1511 duplicate apps in the ios dataset?
-why can’t I get any result when running the second part?

Hi @allahasra20

Output of duplicate apps is something different than yours, maybe you have missed some instructions from the previous slide of mission.

You can take a look at the solutions after attempts. Then you will remember it for a long time.

Please take a look at the post below. It will help you.

:slightly_smiling_face: .

I can see how you got the 1511 duplicates (even though there aren’t that many duplicates in the ios set). I was able to replicate that behavior. The problem is using the same list names duplicate_apps and unique_apps that you used with the android apps set. All that data is still retained in the lists, so when you loop through the ios list, it’s finding which apps the 2 sets have in common.

There’s 2 workarounds you can do.

  1. In the same cell, before the ios loop, put
    duplicate_apps = []
    unique_apps = []
    This will overwrite those 2 variables and give you a clean list to start with.
  2. Initialize and use a different name for the lists when you run the ios loop, like duplicate_apps_ios and duplicate_apps_android.

I personally would choose the 2nd option, but it’s up to you. Either of these should fix it. When I ran the code it gave me 2 duplicate apps for ios.

As far as why it didn’t print the results, I’m not sure about that from the information given and couldn’t replicate that.

I hope that helps.


makes sense! and it worked. I was able to print out the second part and also display the different entries of one of the duplicate.
Thanks a bunch for your input!!!