year=int(input('请输入年:'))
month=int(input('请输入月:'))
day_1=[31,28,31,30,31,30,31,31,30,31,30,31]
day_2=[31,29,31,30,31,30,31,31,30,31,30,31]
if year%4==0 or year%400==0:
print('%d年%d月有%d天'%(year,month,day_2[month-1]))
else:
print('%d年%d月有%d天'%(year,month,day_1[month-1]))
练习:给定y和m,计算y年m月有几天?
最新推荐文章于 2022-09-28 19:52:24 发布