计算每个月有多少天的python基础题
作者:互联网
Year = int(input('请输入年份: ')) Month = int(input('请输入月份: ')) #31天的情况判断 if (Month == 1 or Month == 3 or Month ==5 or Month == 7 or Month == 8 or Month == 10 or Month == 12): print('本月31天') #30天的情况判断 elif (Month == 4 or Month == 6 or Month ==9 or Month == 11): print('本月30天') #闰年2月判断 elif Month ==2 and ((Year % 4 == 0 and Year % 100 !=0 ) or Year % 400 == 0): print('本月29天') #28天情况判断 else: print('本月28天')
标签:elif,每个,python,本月,Month,int,计算,Year,print 来源: https://www.cnblogs.com/xiaobaixuecheng101/p/16490085.html