【发布时间】:2018-03-09 13:01:44
【问题描述】:
谁能告诉我为什么排序在这里不起作用?
b = input()
list1 = input().split()
c = input()
list2 = input().split()
set1 = set(list1)
set2 = set(list2)
list3 = list(set1.union(set2) - set1.intersection(set2))
sorted(list3)
print(list3)
输入格式:
4
2 4 5 9
4
2 4 11 12
【问题讨论】:
-
请添加预期的输出 - 你想达到什么目的?
-
请注意:
set1.union(set2) - set1.intersection(set2)可以写成set1.symmetric_difference(set2)...
标签: python-3.x