num = 0 L = ['Alice', 66, 'Bob', True, 'False', 100] for item in L: num = num + 1 if num % 2 != 0: continue print(item)
if判断的就是是奇数,就直接continue,continue会继续执行循环,不会执行下面的print
num = 0 L = ['Alice', 66, 'Bob', True, 'False', 100] for item in L: num = num + 1 if num % 2 != 0: continue print(item)