- #不同方式输出2000——3000所有的闰年
#方法:for while def 没有switch(if else代替)
def forMean():
for i in range(2000,3001):
if(i % 4 == 0 & i % 100 | i % 400):
print(" “, i)
i += 1
def whileMean():
i = 2000
while(i <= 3000):
if (i % 4 == 0 & i % 100 | i % 400):
print(” ", i)
i += 1
print( “求闰年 \n1.使用for求\n2.使用while求\n”)
op = int(input())
if(op == 1):
forMean()
elif(op == 2):
whileMean()