temp = input("请输入一个年份:")while not temp.isdigit(): print("您的输入不合法") temp = input("请输入一个年份:")year = int(temp)if (year %4==0 and year %100 !=0) or year%400 ==0: print("您输入的年份是闰年")else: print("您输入的年份不是闰年")
本文共 272 字,大约阅读时间需要 1 分钟。
temp = input("请输入一个年份:")while not temp.isdigit(): print("您的输入不合法") temp = input("请输入一个年份:")year = int(temp)if (year %4==0 and year %100 !=0) or year%400 ==0: print("您输入的年份是闰年")else: print("您输入的年份不是闰年")
转载于:https://www.cnblogs.com/sunshining-f/p/8624532.html