函数入门:
编写一个函数,检查获取到的列表对象,如果是奇数,返回对应的偶数,如果是偶数则直接返回原值,并将其作为新列表返回给调用者
names = ['5','7','9','6','4']
def qiuou(names):
b = []
j=len(names)
print(j)
for i in range(0,j):
c = int(names[i])
if c%2 ==1:
b.append(c+1)
else:
b.append(c)
return(b)
l = qiuou(names)
print(l)