def leapYear(year): if 0 == year % 4 and 0 != year % 400 or 0 == year % 400: return True else: return False def getMonthDays(year, month): days = 31 if 2 == month: if leapYear(year): days = 29 else: days = 28 elif 4 == month or 6 == month or 9 == month or 11 == month: days = 30 return days def getTotalDays(year, month): totalDays = 0 for i in range(1901, year): if leapYear(year): totalDays += 366 else: totalDays += 365 for i in range(1, month): totalDays += getMonthDays(year, i) return totalDays year = input("请输入年份:") month = The INPUT ( "Please enter the month: " ) Print () Print ( " Day \ t a \ t two \ t three \ t four \ t five \ t six " ) Print () COUNT = 0 the y- = int (year) m = int (month The ) for I in Range (. 1, getMonthDays (Y, m) + 1'd ): Print (I, End = " \ T " ) COUNT + =. 1 IF 0 == COUNT%. 7 : Print ( " \ n- " ) Print ( " \ the n- ")