9-1
class Restaurant():
def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_restaurant(self):
print("The name of this restaurant is: " + self.restaurant_name, end = '')
print(', and the cuisine type is ' + self.cuisine_type)
def open_restaurant(self):
print("This restaurant is open!")
my_restaurant = Restaurant("Perfect Restaurant", "Chinese food")
his_restaurant = Restaurant("Italian Restaurant", "Itlian food")
my_restaurant.describe_restaurant()
my_restaurant.open_restaurant()
his_restaurant.describe_restaurant()
his_restaurant.open_restaurant()
结果如下: