HackerRank Set .difference() Operation solution in python

In this Hackerrank Set .difference() operation problem Students of District College have a subscription to English and French newspapers. Some students have subscribed to only the English newspaper, some have subscribed to only the French newspaper, and some have subscribed to both newspapers.

You are given two sets of student roll numbers. One set has subscribed to the English newspaper, and one set has subscribed to the French newspaper. Your task is to find the total number of students who have subscribed to only English newspapers.

HackerRank Set .difference() Operation solution in python

Problem solution in Python 2 programming.

eng = set()
fre = set()
n = raw_input()
for i in raw_input().split(' '):
  eng.add(i)
m = raw_input()
for i in raw_input().split(' '):
  fre.add(i)
sol = eng.difference(fre)
print len(sol)

Problem solution in Python 3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
n1 = int(input())
set_1 = set(map(int,input().split()))
n2 = int(input())
set_2 = set(map(int,input().split()))
print(len(set_1-set_2))

Problem solution in pypy programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
n = input()
s = set(map(int, raw_input().split())) 

m = input()
t = set(map(int, raw_input().split()))

print len(s.difference(t))

Problem solution in pypy3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
n1=input()
li1 = input().split()
s1 = set(li1)
n2=input()
li2 = input().split()
s2 = set(li2)
s1s2 = s1.difference(s2)
print(len(s1s2))