包头做网站的,扁平化的网站有哪些,好看的网站排版,做质粒图谱的网站题目#xff1a;打印万年历已知条件闰年条件#xff1a;能被4整除且不能被100整除#xff0c;或者能被400整除1900年1月1日 是周一解题思路判断闰年;判断当月有多少天;这个月的1号是从周几开始的;格式化打印日历。解题代码#判断年份是否为闰年def is_leap_year(year):if (ye…题目打印万年历已知条件闰年条件能被4整除且不能被100整除或者能被400整除1900年1月1日 是周一解题思路判断闰年;判断当月有多少天;这个月的1号是从周几开始的;格式化打印日历。解题代码#判断年份是否为闰年def is_leap_year(year):if (year%40 and year%100!0) or (year%4000):return Trueelse:return False#判断月份有多少天def get_month_day(year,month):days31if month in [4,6,9,11]:days30elif month 2:if is_leap_year(year):days29else:days28return days#求输入年份和月份日期总天数def get_days(year,month):totaldays0for i in range(1900,year):if is_leap_year(i):totaldays366else:totaldays365for i in range(1,month):totaldaysget_month_day(year,i)return totaldays#主程序if __name__ __main__:year input(请输入年份)month input(请输入月份)try:year int(year)month int(month)if month 1 or month 12:print(月份输入错误请重新输入)continueexcept:print(年份或月份输入错误请重新输入)continuebreakprint(日\t一\t二\t三\t四\t五\t六)count 0for i in range((get_days(year,month)%7)1):print(\t,end)count1for i in range(1,get_month_day(year,month)1):print(i,end)print(\t,end)count1if count%7 0:print(/n)