为什么加上输出语句,就报错,不加反而运行成功,代码在下面
def sub_sum(l):
s=0
d=0
for i in l:
if i%2==0:
s=s+i
else:
d=d+i
i=i+1
return s,d
l=[1,2,3,4,5,6,7,8,9,10]
print(s)
print(d)
def sub_sum(l):
s=0
d=0
for i in l:
if i%2==0:
s=s+i
else:
d=d+i
i=i+1
return s,d
l=[1,2,3,4,5,6,7,8,9,10]
print(s)
print(d)
2020-11-26
举报