Question

Find common elements in two lists

Updated on June 2, 2025 | By Learnzy Admin | πŸ‘οΈ Views: 216 students

Solution
βœ” Verified

Using set intersection we can get the common element b/w two list. This is the fast way to get unique common elements, but order is not preserved

list1 = [1, 2, 3, 4]
list2 = [3, 4, 5, 6]

common = list(set(list1) & set(list2))
print(common)  # Output: [3, 4]
Was this solution helpful? 36
Click here to download practice questions on Python Lists

More Questions on Python Lists

Question 1

How to check if two lists are equal?


View solution
Question 2

Is Python list mutable?


View solution
Question 3

How to remove duplicates from a list?


View solution
Question 4

Difference between sort() and sorted()?


View solution
Question 5

What is a list in Python?


View solution
Question 6

How to remove an element from a list?


View solution
Question 7

What is the difference between append() and extend()?


View solution