又错了啊
class Restaurant:
"""餐馆"""
def __init__(self, restaurant_name, cuisine_name):
"""初始化"""
self.restaruant_name= restaurant_name
self.cuisine_name= cuisine_name
def describe_restaurant():
print(f"\n{restaurant_name} is very big and very good!")
print(f"\nthere are lots of foods there,like {cuisine_name} ")
def open_restaurant():
print(f"\n {restaurant_name} is opening!")
restaurant=Restaurant("BBQ","roast fish")
restaurant.describe_restaurant()
restaurant.open_restaurant()
请大家看看,我第二次使用类
报错代码:
Message=describe_restaurant() takes 0 positional arguments but 1 was given
Source=D:\小李\python\《Python编程从入门到实践第二版》练习\第一部分\第九章\第一个class程序\第一个class程序\第一个class程序.py
StackTrace:
File "D:\小李\python\《Python编程从入门到实践第二版》练习\第一部分\第九章\第一个class程序\第一个class程序\第一个class程序.py", line 38, in <module> (Current frame)
restaurant.describe_restaurant()