Symmetric Difference

Sort by

recency

|

1246 Discussions

|

  • + 0 comments

    P = input() W = set(map(int, input().split())) U = input() S = set(map(int, input().split()))

    for i in sorted(W^S): print(i)

  • + 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")