```
# Idea: Space out the hours of the meals evenly during the day (independent of their number), so that the last meal happens no later than 19:00.
import numpy as np
def time_to_min(time):
h, m = list(map(int, time.split(':')))
return h * 60 + m
def min_to_time(mins):
return ':'.join(list(map(
lambda x: ['0', ''][x > 9] + str(x),
divmod(mins, 60))
))
first_meal_time = '08:45'
last_meal_time = '19:00'
max_meals = 6
times = []
first_meal_time_to_min = time_to_min(first_meal_time)
last_meal_time_to_min = time_to_min(last_meal_time)
mins_for_meals = last_meal_time_to_min - first_meal_time_to_min
print('Hours for meals between %s and %s:' % (
first_meal_time,
last_meal_time
))
for meals in range(1, max_meals+1):
if meals == 1:
times = [first_meal_time_to_min + mins_for_meals / 2]
else:
times = np.linspace(
first_meal_time_to_min,
last_meal_time_to_min,
meals
)
times = ', '.join(list(map(min_to_time, map(int, times))))
print('%d meal(s): %s' % (meals, times))
"""
Hours for meals between 08:45 and 19:00:
1 meal(s): 13:52
2 meal(s): 08:45, 19:00
3 meal(s): 08:45, 13:52, 19:00
4 meal(s): 08:45, 12:10, 15:35, 19:00
5 meal(s): 08:45, 11:18, 13:52, 16:26, 19:00
6 meal(s): 08:45, 10:48, 12:51, 14:54, 16:57, 19:00
"""
```

Ideally, in a 24-hour day, two meals would be 12 hours apart and even by taking the hours at the boundaries, we can only achieve this approximately.