Set .symmetric_difference() Operation

Sort by

recency

|

317 Discussions

|

  • + 0 comments

    n = int(input()) A = set(input().split()) b = int(input()) B = set(input().split()) print(len(A^B))

  • + 0 comments

    Here's my code:

    el = int(input())
    e = list(map(int, input().split()))[:el]
    fl = int(input())
    f = list(map(int, input().split()))[:fl]
    print(len(list(set(e).symmetric_difference(f))))
    
  • + 0 comments

    n= int(input()) n_set=set(input().split()) m=int(input()) m_set=set(input().split())

    z = n_set.symmetric_difference(m_set) print(len(z))

  • + 0 comments

    english = int(input()) english_s = set(list(map(int, input().split()))) france = int(input()) france_s = set(list(map(int, input().split()))) print(len(english_s.symmetric_difference(france_s)))

  • + 0 comments

    e = int(input()) count = 0 english_np = set(map(int,input().split())) f = int(input()) french_np = set(map(int,input().split())) diff = english_np.symmetric_difference(french_np) for num in diff: count += 1 print(count)