python
temp = input("请输一个年份:")while not temp.isdigit():
year = int("抱歉,您的输入有误,请输入一个整数:")
year = int(temp)
if year/400 == int (year/400):
print(temp + '是闰年')
elif (year/4 == int(year/4))and(year/100 != int(year/100)):
print(temp+'是闰年')
else :
print(temp+'是闰年')
各位,鱼大大,为什么无法运行?????? year的第一条赋值语句用input,而不是int
后面的缩进和while平齐 year = int(temp) 开始后面的语句要和while语句平齐。
year = int("抱歉,您的输入有误,请输入一个整数:")————改为 temp = input("抱歉,您的输入有误,请输入一个整数:")
页:
[1]