Set .symmetric_difference() Operation

Sort by

recency

|

329 Discussions

|

  • + 0 comments

    For Python3 Platform

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

    n=int(input()) eng=set(map(int,input().split())) m=int(input()) french=set(map(int,input().split())) oeof=eng.symmetric_difference(french) not_common=list(oeof) print(len(not_common))

  • + 0 comments
    a=int(input())
    b=set(map(int,input().split()))
    c=int(input())
    d=set(map(int,input().split()))
    
    print(len(d.difference(b))+len(b.difference(d)))
    
        
    
  • + 0 comments
    def main():
        n = int(input())
        e = set(map(int, input().split()))
        m = int(input())
        f = set(map(int, input().split()))
        
        print(len(e.symmetric_difference(f)))
    
    if __name__ == "__main__":
        main()
    
  • + 0 comments
    a = int(input())
    eng = set(map(int, input().split()))
    b = int(input())
    fre = set(map(int, input().split()))
    
    print(len(eng ^ fre))