本帖最后由 Judie 于 2020-3-20 17:29 编辑 if type((tiaojianthree) != type(1)) and type((tiaojiantwo) == type(1)):
这里括弧括错了!!!
>>> type(True)
<class 'bool'>
>>> type(False)
<class 'bool'>
您瞧 True 和 False 都是 bool
所以 总是不过else
直接你的第一个print语句 这是闰年哦
正解print('输入一个年份 我来判断是否是闰年!')
temp = input()
year = int(temp)
tiaojianone = (year/400)
#能被400整除都是闰年
tiaojiantwo = (year/4)
tiaojianthree = (year/100)
#能被4整除但不能被100整除是闰年
if (type(tiaojianthree) != type(1)) and (type(tiaojiantwo) == type(1)):
print('这是闰年哦')
else:
if type(tiaojianone) == type(1):
print('这是闰年哦')
else:
print('这不是闰年')
看在我这么努力帮你找bug的份上
能求个【最佳答案】嘛
谢谢您! |