i只保存了最后一个闰年,用列表保存所有闰年并输出,星号去括号
def is_leap_year(year):
if year%4==0 and year%100!=0 or year%400==0:
return True
b,c=map(int,input().split())
count=0
d=[]
for i in range(b,c+1):
if is_leap_year(i) is True:
count+=1
d.append(i)
print(count)
print(*d,sep=" ")
我不明白你的代码里count怎么就不在第一行了
放个图出来看看