def get_floor_distribution(N_floors, N_classes):
	"""
	Distribute the number of classes evenly over the number of available floors.

	Parameters
	----------
	N_floors : int
		Number of available floors.
	N_classes : int
		Number of classes in the school.


	Returns
	-------
	floors : dictionary
		Dictionary of the form {floor1:[class_1, class_2, ...], ...}
	floors_inv : dictionary
		Dictionary of the form {class1:floor1, ..., class_N:floor_N}
	"""
	floors = {i:[] for i in range(N_floors)} # starts with 0 (ground floor)
	classes = list(range(1, N_classes + 1))
	classes_per_floor = int(N_classes / N_floors) 
	
	# easiest case: the number of classes is divisible by the number of floors
	if N_classes % N_floors == 0:
		for i, floor in enumerate(range(N_floors)):
			floors[floor] = classes[i * classes_per_floor: \
									i * classes_per_floor + classes_per_floor]
		
	# if there are leftover classes: assign them one-by-one to the existing 
	# floors, starting with the lowest
	else:
		leftover_classes = N_classes % N_floors
		classes_per_floor += 1
		for i, floor in enumerate(range(N_floors)):
			if i < leftover_classes:
				floors[floor] = classes[i * classes_per_floor: \
									  i * classes_per_floor + classes_per_floor]
			# hooray, index magic!
			else:
				floors[floor] = classes[leftover_classes * classes_per_floor + \
						(i - leftover_classes) * (classes_per_floor - 1):
						leftover_classes * (classes_per_floor) + \
						(i - leftover_classes) * (classes_per_floor - 1) + \
						classes_per_floor - 1]
				
	# invert dict for easier use
	floors_inv = {}
	for floor, classes in floors.items():
		for c in classes:
			floors_inv.update({c:floor})
	
	return floors, floors_inv