|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
temp=input("请输入一个年份")
while not temp.isdigit():
print("输入格式不正确,请再输入一个年份:")
temp=input()
year=int(temp)
if year/4 == 0 and year/100 != 0:
print(temp"是闰年")
else:
if year/400 == 0:
print(temp"是闰年")
else:
print(temp"不是闰年")
以上是代码原文,截图也附在图片中
这是报错点
这是报错原因
- temp=input("请输入一个年份:")
- while not temp.isdigit():
- print("输入格式不正确,请再输入一个年份:")
- temp=input()
- year=int(temp)
- if year%4 == 0 and year%100 != 0:
- print('%d是闰年'%year)
- else:
- if year%400 == 0:
- print("%d是闰年"%year)
- else:
- print("%d不是闰年"%year)
复制代码
应该这样写吧,这样写是可以的
|
|