I'm trying to create a simple class that accepts 2 args.
It routinely responds:
TypeError: Restaurant() takes 1 positional argument but 2 were given
EXAMPLE:
def Restaurant(object): <--using the 'object' parameter seems to only allow 1 parameter
"""show info about restaurant""" according to my textbook(using python 3) this should be enough
def __init__(self, name, food):
#define attributes
self.name = name
self.food = food
def restaurant_info(self):
print(self.name.title() + " serves " +
self.food + "food.")
def restaurant_open(self):
print(self.name.title() + " is now open!")
my_restaurant = Restaurant('caputos', 'italian')
It routinely responds:
TypeError: Restaurant() takes 1 positional argument but 2 were given
EXAMPLE:
def Restaurant(object): <--using the 'object' parameter seems to only allow 1 parameter
"""show info about restaurant""" according to my textbook(using python 3) this should be enough
def __init__(self, name, food):
#define attributes
self.name = name
self.food = food
def restaurant_info(self):
print(self.name.title() + " serves " +
self.food + "food.")
def restaurant_open(self):
print(self.name.title() + " is now open!")
my_restaurant = Restaurant('caputos', 'italian')