input: Write a python function to schedule tasks based on their start and end times.
  assert schedule([{'start': 1, 'end': 3}, {'start': 2, 'end': 5}, {'start': 4, 'end': 6}]) == [{'start': 1, 'end': 3}, {'start': 4, 'end': 6}]
  assert schedule([{'start': 0, 'end': 1}, {'start': 3, 'end': 5}, {'start': 1, 'end': 2}, {'start': 5, 'end': 6}]) == [{'start': 0, 'end': 1}, {'start': 1, 'end': 2}, {'start': 3, 'end': 5}, {'start': 5, 'end': 6}]
  assert schedule([{'start': 0, 'end': 2}, {'start': 1, 'end': 3}, {'start': 3, 'end': 5}]) == [{'start': 0, 'end': 2}, {'start': 3, 'end': 5}]
output: def schedule(tasks):
      # Sort tasks by their end times
      tasks.sort(key=lambda x: x['end'])
  
      # Initialize the list of scheduled tasks
      scheduled = []
  
      # Track the end time of the last added task
      last_end_time = float('-inf')
  
      for task in tasks:
          if task['start'] >= last_end_time:
              scheduled.append(task)
              last_end_time = task['end']
  
      return scheduled