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.
Set .intersection() Operation
Set .intersection() Operation
+ 0 comments if __name__=="__main__": n1=int(input()) l1=set(map(int, input().split())) n2=int(input()) l2=set(map(int, input().split())) l=l1.intersection(l2) print(len(l))
+ 0 comments # Enter your code here. Read input from STDIN. Print output to STDOUT n = int(input()) eng = input() eng = {a for a in eng.split()} m = int(input()) fren = input() fren = {b for b in fren.split()} eng.intersection_update(fren) print(len(eng))
+ 0 comments n1=int(input()) set1=set(map(int,input().split())) n2=int(input()) set2=set(map(int,input().split())) print(len(set1.intersection(set2)))
+ 0 comments PYTHON 3
input() set1 = set(map(int, input().split())) input() set2 = set(map(int, input().split())) print(len(set1 & set2))
+ 0 comments input() s = set(input().split()) input() print(len(s.intersection(input().split())))
Load more conversations
Sort 334 Discussions, By:
Please Login in order to post a comment