Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Merge Lists without Duplicates

Solution 😎

l1 = [4, 5, 34, 9]
l2 = [4, 5, 80, 10]
result = list(set(l1 + l2))

print('first list:', l1)
print('second list:', l2)
print('result:', result)

This code takes two lists as input, and first merges them using the + operator. Then, it converts the merged list to a set using the set() function to remove duplicates, and converts the resulting set back to a list using the list() function.

Video Solution 📹

Merge Lists without Duplicates

<iframe width="560" height="315" src="https://www.youtube.com/embed/I6-oQS8eVUY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>