generate functionTue, 21 Feb 2023

m and n are entered (in one line separated by a space) to determine: a) the date of the previous day (assume that m and n do not characterize January 1); b) the date of the next day (assume that m and n do not characterize December 31). The problem is to assume that the year is not a leap year. Print the previous date and the next date (in the format: mm.dd, where m is the day of the month; d is the number of the day) in one line separated by a space. P.S. Number of days in non-leap year months starting from January: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31

m = int(input()) n = int(input()) if m == 1: print('12', n-1) elif n == 1: print(m-1, 31) elif m == 3: print(2, n-1) elif m == 8 or m == 5 or m == 10 or m == 12: print(m, n-1) else: print(m, n-1) if m == 12: print('1', n+1) elif n == 31: if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10: print(m+1, 1) else: print(m, n+1) elif m == 2: print(m, n+1) else: print(m, n+1)

Questions about programming?Chat with your personal AI assistant