'int' object is not subscriptable in my code
<p>I'm trying to write a program in Python that will compare two 4-digit numbers, one given by the player and one generated by the computer, and tell the player how many cows and bulls they get - cows being matching numbers in the wrong places and bulls being matching numbers in the right places. I keep getting an <code>'int' object is not subscriptable</code> error every time I try it. I know that means I need to make the int <code>guess</code> a string, but even when I try to do that it gives me the same error in the same place. Any pointers?</p>

<pre><code>def how_many_bulls(answer,guess):
    ''' Returns the number of bulls the guess earns when the secret number
    is the answer. '''
    bulls = 0
    if guess[0] == answer[0]:
        bulls = bulls+1
        if guess[1] == answer[1]:
            bulls = bulls+1
            if guess[2] == answer[2]:
                bulls = bulls+1
                if guess[3] == answer[3]:
                    bulls = bulls+1
    return bulls
</code></pre>

<p>Sorry if I've formatted anything wrong - my first time using the site.</p>

<p>You can make the guess a list:</p>

<pre><code>guess = [1,2,3,4]
</code></pre>

python