HackerRank Python - Set Difference Operation

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).

  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. e = int(input())
  3. eng = set(map(int,input().split()))
  4. f = int(input())
  5. fre = set(map(int,input().split()))
  6. print(len(eng - fre))
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube