Symmetric Difference

Sort by

recency

|

1245 Discussions

|

  • + 0 comments
    a = set(map(int, input().split()))
    N = input()
    b = set(map(int, input().split()))
    
    for i in sorted(a^b):
        print(i)
    
  • + 0 comments
    M = input()
    a = set(map(int, input().split()))
    N = input()
    b = set(map(int, input().split()))
    
    result = sorted(a^b)
    
    for i in result:
        print(i)
    
  • + 0 comments

    could have done it without the loop, but too many brackets don't look good

    M = input()
    M = set(map(int, input().split()))
    N = input()
    N = set(map(int, input().split()))
    S = sorted((M.difference(N)).union(N.difference(M)))
    for val in S:
        print(val)
    
  • + 0 comments

    For Python3 Platform

    m = int(input())
    M = set(map(int, input().split()))
    n = int(input())
    N = set(map(int, input().split()))
    
    print(*sorted(M.symmetric_difference(N)), sep="\n")
    
  • + 0 comments

    This blog is very beneficial for me! Symmetric difference is especially useful when comparing datasets to find mismatches, differences, or "exclusive" elements. 11xPlay New ID