已知L=[1,2,4,3,5,9],选出L中的偶数,直到出现第1个奇数
L=[6,2,4,3,5,9]
L1=[]
for i in range(len(L)):
if L[i]%2==0:
L1.append(L[i])
print(L1)
L=[6,2,4,3,5,9]
unstop=1 #1的布尔值为True,借此做死循环
index=0
while unstop:
if L[index]%2==0:
print(L[index])
index=index+1
else:
unstop=0 #0的布尔值为False,借此终止循环