import datetime date = datetime.date(2015, 1, 1) ans = 0 while date.year ==2015: day = date.day month = date.month day1 = int(day/10) day2 = day%10 if month == day1 + day2: ans += 1 #print(date.year,date.month, date.day,ans) date = date + datetime.timedelta(days=1) print(ans)