If statement not firing
<p>This code does a recursive bisection search for a character in a string.  </p>

<p>When the <code>print</code> statements are not commented out, it seems to work well with the recursion and bisection, but the <code>if</code> statement that returns <code>True</code> does not seem to fire.</p>

<pre><code>def isIn(char, aStr):
    '''
    char: a single character
    aStr: an alphabetized string

    returns: True if char is in aStr; False otherwise
    '''
    b = sorted(aStr)
    c = len(aStr)
    # print("string b " + str(b))
    # print("c " + str(c))
    # print("element middle: " + str(b[round(c/2)]))
    #print("char: " + str(char))
    #print(str(char) == str(b[round(c/2)]))
    if ((str(char) == str(b[round(c/2)]))): # this if statement does not seem to fire
        return True
    elif (c == 1 and char != str(b[round(c/2)])) or (c == 0 and char != "") :
        return False
        #print("false")
    else:

        #if str(char) == str(b[round(c/2)]):
         #   return True
           # print("true")
        if char &gt; b[round(c/2)]:
            isIn(char, b[round(c/2):c])

        elif char &lt; b[round(c/2)]:
            isIn(char, b[0:round(c/2)])
        else:
            return False
            #print('fales')
</code></pre>

<p>You need to return the result of each recursive call.</p>

<p>This is a very common mistake, for some reason.</p>

python