发布网友
共1个回答
热心网友
def shili(a,b):
answer=[]
for x in a:
if x<=b/2:
y=b-x
if y in a :
answer.append((x,y))
return answer
a=[1,2,3,4,5,6,7,8,9]
b=9
c=shili(a,b)
print(c)
#输出结果:[(1, 8), (2, 7), (3, 6), (4, 5)]