Skip to content

Instantly share code, notes, and snippets.

@Abidzar16
Created August 14, 2020 05:01
Show Gist options
  • Save Abidzar16/0505a073a5922cf842ed00e228a4a4c4 to your computer and use it in GitHub Desktop.
Save Abidzar16/0505a073a5922cf842ed00e228a4a4c4 to your computer and use it in GitHub Desktop.
DE_Python soal nomor 1
def unique_names(names1, names2):
names1 = list(dict.fromkeys(names1))
names2 = list(dict.fromkeys(names2))
names1.extend(x for x in names2 if x not in names1)
return names1
names1 = ["Ava", "Emma", "Olivia"]
names2 = ["Olivia", "Sophia", "Emma"]
print(unique_names(names1, names2)) # should print Ava, Emma, Olivia, Sophia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment