Set .difference() Operation

Sort by

recency

|

365 Discussions

|

  • + 0 comments

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

  • + 0 comments
    def stud_eng(a,b):
        return len(a.difference(b))  #a-b
    
    
    
    if __name__ == '__main__':
        n = int(input())
        set1 = set(map(int,input().split()))
        b = int(input())
        set2 = set(map(int,input().split()))
        
        print(stud_eng(set1,set2))
    
  • + 0 comments
    e=int(input())
    n=set(map(int,input().split()))
    f=int(input())
    m=set(map(int,input().split()))
    print(len(n-m))
    
  • + 0 comments

    a=int(input()) english=set(map(int,input().split()))

    b=int(input()) french=set(map(int,input().split()))

    result=english.difference(french) print(len(result))

  • [deleted]Challenge Author
    + 0 comments

    For Python3

    e = int(input())
    english = set(input().split())
    f = int(input())
    french = input().split()
    
    print(len(english.difference(french)))