I'm trying to create and play with classes in Python 3.6 but I'm getting the following error when I try to call a method that prints info about my class:
'TypeError: not enough arguments for format string'
And here's the code I'm trying to run:
class Restaurant(object):
def __init__(self, name, type):
self.name = name
self.type = type
def describe(self):
print("Restaurant name: %s , Cuisine type: %s" % self.name, self.type)
def open_restaurant(self):
print("%s is now open!" % self.name)
my_restaurant = Restaurant("Domino", "Pizza")
my_restaurant.describe()
my_restaurant.open_restaurant()
The open_restaurant() method works fine but with my_restaurant.describe() I receive the error message I mentioned.
%is% (self.name, self.type)typeas a variable name.