num=int(input(' 请输入一个月份:')) if num in (1,3,5,7,8,10,12): print('31天') elif num ==2: year = int(input(' 年份:')) if (year%100!=0 and year%4==0 or num%400==0): #能被4整除但不能被100整除,或者能被400整除即为闰年 print('29天') else: print('28天') else: print("30天")
python输入一个月份,输出有多少天,如果是2月,并判断平年闰年输出天数
猜你喜欢
转载自blog.csdn.net/qq_38262155/article/details/80370272
今日推荐
周排行