*SCHEDULE YOUR DA(RRA)Y*
        
The best way to have a productive day is to plan out your work schedule. Given the following three inputs, please create an an array of time alloted to work, broken up with time alloted with breaks:
        
Input 1: Hours - Number of hours available to you to get your work done! 
Input 2: Tasks - How many tasks you have to do througout the day
Input 3: Duration (minutes)- How long each of your tasks will take to complete
Criteria to bear in mind:
- Your schedule should start with work and end with work.
- It should also be in minutes, rounded to the nearest whole minute. 
- If your work is going to take more time than you have, return "You're not sleeping tonight!"
Example:

```python
day_plan(8, 5, 30) == [ 30, 82, 30, 82, 30, 82, 30, 82, 30 ]
day_plan(3, 5, 60) == "You're not sleeping tonight!"
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Mathematics

Starter code: def day_plan(hours, tasks, duration):
	

Solutions:
def day_plan(hours, tasks, duration):
	(td, hm, tmo) = (tasks * duration, hours * 60, tasks - 1)
	if td > hm:
		return "You're not sleeping tonight!"
	arr = [0] * (tasks + tmo)
	(arr[::2], arr[1::2]) = ([duration] * tasks, [round((hm - td) / (tmo or 1))] * tmo)
	return arr


def day_plan(hours, tasks, duration):
	breaks = (hours * 60 - tasks * duration) / (tasks - 1) if tasks > 1 else 0
	if breaks < 0:
		return "You're not sleeping tonight!"
	return ([duration, round(breaks)] * tasks)[:-1]


def day_plan(hours, tasks, duration):
	mins = hours * 60
	task_mins = tasks * duration
	relaxation = (mins - task_mins) / max(1, tasks - 1)
	if relaxation < 0:
		return "You're not sleeping tonight!"
	task_list = ([duration, round(relaxation, 0)] * tasks)[:-1]
	return task_list


def day_plan(hours, tasks, duration):
	if tasks < 2:
		return [duration] * tasks
	elif tasks * duration / 60 > hours:
		return "You're not sleeping tonight!"
	else:
		r = round((hours * 60 - tasks * duration) / (tasks - 1))
		return [duration, r] * (tasks - 1) + [duration]


def day_plan(hours, tasks, duration):
	break_time = hours * 60 - tasks * duration
	if break_time < 0:
		return "You're not sleeping tonight!"
	else:
		schedule = [0] * (2 * tasks - 1)
		schedule[::2] = [duration] * tasks
		schedule[1::2] = [round(break_time / (tasks - 1 + 1e-09))] * (tasks - 1)
		return schedule


day_plan = lambda h, t, d: t * d > h * 60 and "You're not sleeping tonight!" or ([(h * 60 - t * d) // (t - 1 + 1e-09), d] * t)[1:]


def day_plan(hours, tasks, duration):
	if tasks == 0:
		return []
	if tasks == 1:
		return [duration]
	stop = round((hours * 60 - duration * tasks) / (tasks - 1))
	if stop < 0:
		return "You're not sleeping tonight!"
	res = [None] * (2 * tasks - 1)
	res[::2] = [duration] * tasks
	res[1::2] = [stop] * (tasks - 1)
	return res


def day_plan(hours, tasks, duration):
	at = tasks * duration
	tb = hours * 60 - at
	plan = []
	if tb < 0:
		return "You're not sleeping tonight!"
	elif tasks == 0:
		return plan
	elif tasks == 1:
		plan = [duration]
	else:
		plan = [duration]
		bt = round(tb / (tasks - 1))
		for i in range(tasks - 1):
			plan.append(bt)
			plan.append(duration)
	return plan


def day_plan(hours, tasks, duration):
	total_minutes = hours * 60
	tasks_minutes = tasks * duration
	if tasks_minutes > total_minutes:
		return "You're not sleeping tonight!"
	brk = round((total_minutes - tasks_minutes) / (tasks - 1)) if tasks > 1 else 0
	return [brk if i % 2 else duration for i in range(2 * tasks - 1)]


def day_plan(hours, tasks, duration):
	minutes = hours * 60
	if tasks * duration > minutes:
		return "You're not sleeping tonight!"
	elif tasks == 1:
		return [duration]
	elif tasks == 0:
		return []
	break_length = round((minutes - tasks * duration) / (tasks - 1))
	return [duration, break_length] * (tasks - 1) + [duration]