import datetime d = datetime.date(2015, 1, 1) s = datetime.timedelta(days = 1) h_day_count = 0 while d.year == 2015: [a, b] = divmod(d.day, 10) if ((a + b) == d.month): h_day_count += 1 d += s print(h_day_count)