Set .difference() Operation

Sort by

recency

|

369 Discussions

|

  • + 0 comments

    For Python3 Platform

    n = int(input())
    english = set(map(int, input().split()))
    b = int(input())
    french = set(map(int, input().split()))
    
    print(len(english.difference(french)))
    
  • + 0 comments

    n=int(input()) eng=set(map(int,input().split())) m=int(input()) french=set(map(int,input().split())) only_eng1=eng.difference(french) onlyeng2=list(only_eng1) print(len(onlyeng2))

  • + 0 comments

    n = int(input()) a = set(input().split()) e =int(input()) b = set(input().split()) r = a.difference(b) print (len(r)) We need to perform the same technique like intersection() method

  • + 0 comments

    Using .difference() here is just like how the Top 10 International Law Firms in London stand out by specializing in unique areas filtering out what's not needed and keeping only what matters.

  • + 0 comments

    n=int(input()) s=set(input().split()) n1=int(input()) s1=set(input().split()) print(len(s - s1))