O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

9-1. Restaurant:

From

Cover of Python Crash Course

Note

class Restaurant(object):
def init(self, name, cuisine_type, status=0):
self.name = name
self.ctype = cuisine_type
self.status = status

def describe_restaurant(self):
    print('\nrestaurant name: ' + self.name.title())
    print('restaurant cuisine type: ' + self.ctype.title())
    if self.status == 0:
        message = 'not open yet!'
    else:
        message = 'open'
    print('status: ' + message)

def open_restaurant(self):
    if self.status != 0:
        print('restaurant has openned!')
        return
    self.status = 1
    print('open the r...