In this **HackerRank Set .intersection() Operation problem solution** The students of District College have subscriptions to English and French newspapers. Some students have subscribed only to English, some have subscribed only to French, and some have subscribed to both newspapers. You are given two sets of student roll numbers. One set has subscribed to the English newspaper, one set has subscribed to the French newspaper. Your task is to find the total number of students who have subscribed to both newspapers.

## HackerRank Set .intersection() Operation in python problem solution

# Enter your code here. Read input from STDIN. Print output to STDOUT s = set() s2 = set() n = int(raw_input()) elements = raw_input().split() for i in range(0, len(elements)): s.add(int(elements[i])) n2 = int(raw_input()) elements2 = raw_input().split() for i in range(0, len(elements2)): s2.add(int(elements2[i])) print len(s.intersection(s2))

## 0 Comments