
# Python code t get difference of two lists # Using set() def Diff(li1, li2): return list(set(li1) - set(li2)) + list(set(li2) - set(li1)) # Driver Code li1 = [10, 15, 20, 25, 30, 35, 40] li2 = [25, 40, 35] print(Diff(li1, li2))
I’ve also provided the Python source code to find the difference between two lists without using the set() method. This way you can easily compare both methods.
# Python code to get difference of two lists # Not using set() def Diff(li1, li2): li_dif = [i for i in li1 + li2 if i not in li1 or i not in li2] return li_dif # Driver Code li1 = [10, 15, 20, 25, 30, 35, 40] li2 = [25, 40, 35] li3 = Diff(li1, li2) print(li3)
Google Chrome has dominated web browsing for over a decade with 71.77% global market share.…
Perplexity just made its AI-powered browser, Comet, completely free for everyone on October 2, 2025.…
You've probably heard about ChatGPT Atlas, OpenAI's new AI-powered browser that launched on October 21,…
Perplexity Comet became free for everyone on October 2, 2025, bringing research-focused AI browsing to…
ChatGPT Atlas launched on October 21, 2025, but it's only available on macOS. If you're…
Two AI browsers just entered the ring in October 2025, and they're both fighting for…