Python 需要帮助了解为什么方法更新和custmoru增量没有按应有的方式添加和打印吗
我需要帮助了解如何更新你的坐姿,以打印出现在有多少人坐着Python 需要帮助了解为什么方法更新和custmoru增量没有按应有的方式添加和打印吗,python,Python,我需要帮助了解如何更新你的坐姿,以打印出现在有多少人坐着 要让custmor\u increment打印新的custmor数量。要打印有多少人坐着,方法需要返回self.number\u served 你还需要修正打字错误和缩进 class Restaurant(): """intalizing attributes rest._type and food_type""" def __init__(self,resturant_type,*food_type):
要让custmor\u increment打印新的custmor数量。要打印有多少人坐着,方法需要返回
self.number\u served
你还需要修正打字错误和缩进
class Restaurant():
"""intalizing attributes rest._type and food_type"""
def __init__(self,resturant_type,*food_type):
self.rest_type = resturant_type
self.food = food_type
self.number_severd = 0
def opening(self):
"""Letting people know that the resturant is open"""
print(self.rest_type.title() + " is now open")
def describing_rest(self):
"""telling you about resturant"""
print("\nWelcome to " + self.rest_type.title() +
" here are what we have on the menu today: ")
for self.foods in self.food:
print("-" + self.foods)
def updating_sitting(self,new_chart):
"""updating sitting chart"""
self.number_served = new_chart
def custmor_increment(self,addition):
"""add number to custmor count"""
self.number_severd += addition
rest = Restaurant('High Spot','Turkey sandwich','pizza','deserts')
rest.opening()
rest.describing_rest()
rest.number_severd = 230
print("we have " + str(rest.updating_sitting(400)))
print("now we have " + str(rest.custmor_increment(100)))
顺便说一句,“custmor”的正确拼写是“customer”您能否更清楚地说明正在发生的事情以及您试图实现的目标?是的,很抱歉,我试图让“更新”方法能够打印出当前的客户数量,然后当我使用“客户增量”添加增量以打印新值时,下面的答案解决了吗?是的,谢谢你试图帮助我。
class Restaurant():
def __init__(self,resturant_type,*food_type):
"""intalizing attributes rest._type and food_type"""
self.rest_type = resturant_type
self.food = food_type
self.number_served = 0
def opening(self):
"""Letting people know that the resturant is open"""
print(self.rest_type.title() + " is now open")
def describing_rest(self):
"""telling you about resturant"""
print("\nWelcome to " + self.rest_type.title() +
" here are what we have on the menu today: ")
for self.foods in self.food:
print("-" + self.foods)
def updating_sitting(self,new_chart):
"""updating sitting chart"""
self.number_served = new_chart
return self.number_served
def custmor_increment(self,addition):
"""add number to custmor count"""
self.number_served += addition
return self.number_served
rest = Restaurant('High Spot','Turkey sandwich','pizza','deserts')
rest.opening()
rest.describing_rest()
rest.number_served = 230
print("we have " + str(rest.updating_sitting(400)))
print("now we have " + str(rest.custmor_increment(100)))