自写判断闰年的代码
temp = input('请您输入一个年份,让二麓判断一下吧~~~')bool = False
while bool == False:
while str.isdigit(temp) != True:
print('这不是年份哦~')
temp = input('请重新输入一个年份让二麓判断一下吧~~~')
year = int(temp)
year = int(temp)
if(year % 400 == 0) or (year % 4 == 0 and year % 100 != 0) :
print (temp+'年是闰年哦,好棒啊~~~^_^')
bool = True
if year % 400 == 0:
print('竟然是世纪闰年啊啊啊啊,好激动~')
else:
print('是个普通闰年啊,也很棒哦!')
else:
print(temp+'年不是闰年哦!T_T')
temp = input('再来一次吧!~二麓等你哦~')
bool = False
input('')
{:10_249:}
页:
[1]