import calendar c = calendar.Calendar() total = 0 for i in range(1, 13): m = c.monthdatescalendar(2015, i) for a in m: for b in a: if b.year == 2015: split_day = str(b.day).zfill(2) if i == int(split_day[0]) + int(split_day[1]): total += 1 print(total)