while True:
year = input("输入年份:")
if not year.isdigit():
print("年份必须是数字")
continue
year = int(year)
if year % 4 == 0 and year % 100 != 0 or year % 400 ==0:
print(f"{year}是闰年")
else:
print(f"{year}不是闰年")
break
python_闰年问题
于 2022-07-05 18:19:43 首次发布