We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Set .symmetric_difference() Operation
Set .symmetric_difference() Operation
+ 0 comments lol the int input in between sets are redundant. are they just there to confuse us. they have no use at all
+ 0 comments eng_num = int(input()) eng_list = set(*[(int(i) for i in input().split())]) french_num = int(input()) french_list = set(*[(int(i) for i in input().split())]) unique_list = eng_list.symmetric_difference(french_list) answer = 0 for i in unique_list: answer += 1 print(answer)
+ 0 comments a=input().split() b=set(input().split()) c=input().split() d=set(input().split()) print(len(b.symmetric_difference(d)))
+ 0 comments n_english = int(input()) students_english = set(input().split()) n_french = int(input()) students_french = input().split() print(len(students_english.symmetric_difference(students_french)))
+ 0 comments if __name__ == "__main__": _, english_students = int(input()), set(map(int, input().split())) _, french_students = int(input()), set(map(int, input().split())) print(len(english_students ^ french_students))
Load more conversations
Sort 243 Discussions, By:
Please Login in order to post a comment