How to get the difference between two lists in Python

Опубликовано: 24 Апрель 2026
на канале: 60 Second How-to
129
1

Subscribe for more
#howto #python #pythonprogramming #pythontutorial #tutorial #1minutevideo #60secondsvideo #fasttutorial #beginners #coding #developer #list

Full Code Snippet

Example 1:
--------------------------
list1 = ['Vivian, 'Eric', 'John', 'Mark', 'David']
list2 = ['Vivian', 'Eric', 'John']

set1 = set(list1)
set2 = set(list2)

list3 = list(set1.symmetric_difference(set2))
print(list3)