class Table:
    def __init__(self, name, capacity, status="비어있음"):
        self.name = name
        self.capacity = capacity
        self.status = status


class Restaurant:
    def __init__(self, tables):
        self.tables = tables

    def reserve(self, people):
        for table in self.tables:
            if table.capacity >= people and table.status == "비어있음":
                table.status = "예약됨"
                print(f"{table.capacity}인석 {table.name} 테이블로 배정되었습니다. 즐거운 식사 되십시오.")
                return
        print("예약 가능한 테이블이 없습니다.")

tables = [
    Table("A-1", 2, "만석"),
    Table("B-2", 4),
    Table("B-3", 4)
]

restaurant = Restaurant(tables)
restaurant.reserve(3)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: