temp = input("请输入一个年份:\n") while not temp.isdigit(): temp = input("抱歉,您输入有误,请输入一个正确的年份:\n") if int(temp)%400==0: print("闰年") else: if int(temp)%4==0 and int(temp)%100!=0: print("闰年") else: print("非闰年")
判断闰年
最新推荐文章于 2022-04-19 15:36:40 发布
temp = input("请输入一个年份:\n") while not temp.isdigit(): temp = input("抱歉,您输入有误,请输入一个正确的年份:\n") if int(temp)%400==0: print("闰年") else: if int(temp)%4==0 and int(temp)%100!=0: print("闰年") else: print("非闰年")