Python: Using Classes to re-ask a prompt if answer is incorrect
<p>The code below creates a hero named Luke. Luke has to choose if he wants to eat apples or ham from the table of food he found. </p>

<p>If the user doesn't pick "apple" or "ham", how can I make it so that the user is re-asked the question to choose "apple" or "ham"? </p>

<p>I want to learn how to do this within a class. I feel as though I need to do something below my print statement in else, but <code>self.food()</code> leads to an error saying str is not callable. </p>

<pre><code>    class Hero():

    def __init__(self, name):
        self.name = name
        self.health = 100   
        self.food = raw_input("You encounter a table full of apples and ham. Which do you eat first? ") 

    def eat(self):  
        x = True
        while x == True:
            if (self.food == 'apple'):
                self.health -= 100
                print "%s has %d health points" % (self.name, self.health)
                x = False
            elif (self.food == 'ham'):
                self.health += 20
                print self.health
                print "%s has %d health points" % (self.name, self.health)
                x = False
            else:
                print "Incorrect. Please try again"
                break

char_1 = Hero("Luke")
char_1.eat()
</code></pre>

<p>Edit:</p>

<p>Changes after Alex's help.</p>

<pre><code>class Hero():

    def __init__(self, name):
        self.name = name
        self.health = 100

    def eat(self):
        while self.health &gt; 0:
            food = raw_input("You encounter a table full of apples and ham. Which do you eat first? ")
            if (food == 'apple'):
                self.health -= 10
                print "%s has %d health points" % (self.name, self.health)
            elif (food == 'ham'):
                self.health += 20
                print self.health
                print "%s has %d health points" % (self.name, self.health)
            else:
                print "Incorrect. Please try again"


char_1 = Hero("Luke")
char_1.eat()
</code></pre>