Calling out a function, not defined error
<p>I'm new to making classes and I'm trying to complete exercise 9-1 in my 'Python Crash Course' book where the last part of the question asks me to call back my method but I end up getting</p>

<blockquote>
  <p>'not defined error' for <code>describe_restaurant()</code>.</p>
</blockquote>

<p><strong>Here is my code:</strong></p>

<pre><code>class Restaurant():
    def __init__(self, r_name, c_type):
        self.r_name = r_name
        self.c_type = c_type

    def describe_restaurant():
        print(self.r_name.title())
        print(self.c_type.title())

    def open_restaurant():
        print(self.r_name + " is now open!")

Restaurant = Restaurant('Joe\'s Sushi', 'sushi')

print(Restaurant.r_name)
print(Restaurant.c_type)

describe_restaurant()
open_restaurant()
</code></pre>

<p>I thought that <code>describe_restaurant</code> shouldn't need to be defined though because I'm calling it out as a function to use?</p>

<p>Try:</p>

<pre><code>class Restaurant():
    def __init__(self, r_name, c_type):
        self.r_name = r_name
        self.c_type = c_type

    def describe_restaurant(self):
        print(self.r_name)
        print(self.c_type)

    def open_restaurant(self):
        return "{} is now open!".format(self.r_name)

restaurant = Restaurant('Joe\'s Sushi', 'sushi')

print(restaurant.r_name)
print(restaurant.c_type)

restaurant.describe_restaurant()
restaurant.open_restaurant()
</code></pre>

<p>You need to create a class instance and call it's functions. In addition, as mentioned in the comments, you need to pass <code>self</code> to the instance methods. A short explanation of this can be found <a href="https://pythontips.com/2013/08/07/the-self-variable-in-python-explained/" rel="nofollow">here</a>.</p>

python class