Untitled

 avatar
unknown
plain_text
3 years ago
896 B
2
Indexable
# Define a class for a schedule item
class ScheduleItem:
  def __init__(self, title, start_time, end_time):
    self.title = title
    self.start_time = start_time
    self.end_time = end_time

# Define a class for a schedule
class Schedule:
  def __init__(self):
    self.items = []

  # Add a new schedule item to the list
  def add_item(self, item):
    self.items.append(item)

  # Print the schedule
  def print_schedule(self):
    print("Schedule:")
    for item in self.items:
      print(f"{item.start_time} - {item.end_time}: {item.title}")

# Create a new schedule
schedule = Schedule()

# Add some schedule items
schedule.add_item(ScheduleItem("Meeting with Bob", "9:00 AM", "10:00 AM"))
schedule.add_item(ScheduleItem("Lunch with Alice", "12:00 PM", "1:00 PM"))
schedule.add_item(ScheduleItem("Call with Sarah", "3:00 PM", "3:30 PM"))

# Print the schedule
schedule.print_schedule()

Editor is loading...