happy_day = 0 month = [31, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] for i in range(len(month)): for j in range(month[i]): day = str(j) a = int(day[0:1]) b = int(day[1:2]) if day[1:2] else 0 if i == a + b: happy_day += 1 print(happy_day)