I don't understand the code for Checking Duplicate

duplicate_apps =
unique_apps =

for app in android:
name = app[0]
if name in unique_apps:
duplicate_apps.append(name)
else:
unique_apps.append(name)

Hi,
I’m looking at the above code and I don’t understand it.
Those lists I initialized are empty, so if I pick ‘Wechat’ first time, the condition will be True, then I load it in duplicate_apps, if I pick it again on the second iteration, the condition would still be true, and it will go into duplicate_apps again. Is there anything I’m missing here?

1 Like

Oh my bad, I got it, I read the code wrong.

2 Likes