code: def schedule_to_array(schedule, events, slots):
      
      array = np.zeros((len(events), len(slots)), dtype=np.int8)
      for item in schedule:
          array[events.index(item.event), slots.index(item.slot)] = 1
      return array
docs: Convert a schedule from schedule to array form
  
      Parameters
      ----------
      schedule : list or tuple
          of instances of :py:class:`resources.ScheduledItem`
      events : list or tuple
          of :py:class:`resources.Event` instances
      slots : list or tuple
          of :py:class:`resources.Slot` instances
  
      Returns
      -------
      np.array
          An E by S array (X) where E is the number of events and S the
          number of slots. Xij is 1 if event i is scheduled in slot j and
          zero otherwise