We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Sets
- Set .difference() Operation
- Discussions
Set .difference() Operation
Set .difference() Operation
Sort by
recency
|
369 Discussions
|
Please Login in order to post a comment
For Python3 Platform
n=int(input()) eng=set(map(int,input().split())) m=int(input()) french=set(map(int,input().split())) only_eng1=eng.difference(french) onlyeng2=list(only_eng1) print(len(onlyeng2))
n = int(input()) a = set(input().split()) e =int(input()) b = set(input().split()) r = a.difference(b) print (len(r)) We need to perform the same technique like intersection() method
Using
.difference()
here is just like how the Top 10 International Law Firms in London stand out by specializing in unique areas filtering out what's not needed and keeping only what matters.n=int(input()) s=set(input().split()) n1=int(input()) s1=set(input().split()) print(len(s - s1))