HackerRank Python - Set Difference Operation
.difference()
The tool .difference() returns a set with all the elements from the set that are not in an iterable.
Sometimes the - operator is used in place of the .difference() tool, but it only operates on the set of elements in set.
Set is immutable to the .difference() operation (or the - operation).
- # Enter your code here. Read input from STDIN. Print output to STDOUT
-
- e = int(input())
- eng = set(map(int,input().split()))
- f = int(input())
- fre = set(map(int,input().split()))
- print(len(eng - fre))