input: Write a python function to generate a daily calendar for given tasks and appointments.
  assert generate_calendar([{'name': 'Write code', 'time': '8pm'}, {'name': 'Complete project', 'time': '9pm'}], [{'name': 'Meeting with Bob', 'time': '2pm'}, {'name': 'Meeting with Alice', 'time': '4pm'}]) == {'Wednesday': {'tasks': {'name': 'Complete project', 'time': '9pm'}, 'appointments': {'name': 'Meeting with Alice', 'time': '4pm'}}}
  assert generate_calendar([{'name': 'Exercise', 'time': '7am'}, {'name': 'Breakfast', 'time': '8am'}], [{'name': 'Call with John', 'time': '9am'}, {'name': 'Doctor appointment', 'time': '11am'}]) == {'Wednesday': {'tasks': {'name': 'Breakfast', 'time': '8am'}, 'appointments': {'name': 'Doctor appointment', 'time': '11am'}}}
  assert generate_calendar([], []) == {'Wednesday': {}}
output: def generate_calendar(tasks, appointments):
      calendar = {'Wednesday': {}}
      
      if tasks:
          calendar['Wednesday']['tasks'] = max(tasks, key=lambda x: x['time'])
      
      if appointments:
          calendar['Wednesday']['appointments'] = max(appointments, key=lambda x: x['time'])
      
      return calendar