|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
print("---------闰年查询工具----------\n")
temp = input("请输入您想查询的年份(例如:1988)\n")
while not temp.isdigit():
temp = input("输入错误,请输入数字年份\n")
temp = int(temp)
if temp%400 == 0:
print(temp + "年是闰年哦!")
else:
if temp%4 ==0 and temp%100 !=0:
print(temp + "年是闰年~~~")
else:
print(temp + "年不是是闰年")
运行之后输入2000
---------闰年查询工具----------
请输入您想查询的年份(例如:1988)
2000
Traceback (most recent call last):
File "E:\编程\第四课\作业.py", line 7, in <module>
print(temp + "年是闰年哦!")
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>> |
|