day_month = [31, 28, 31, 30, 31, 30, 31, 31, 31, 31, 30, 31] count = 0 for i in range(12): month = i + 1 for j in range(day_month[i]): day = j + 1 listed_day = list(str(day)) sum_day = sum([int(cur) for cur in listed_day]) if month == sum_day: count += 1 res = count print(res)