title: Python recursive return
body: <p>I'm doing a method to check if a Binary Search Tree(BST) is a Red-Black Tree</p>
  
  <pre><code>def isRedBlack(tree,index):
          if(tree[0][1]=='red'):
              return False
          elif(tree[index][0]=='EMPTY' and tree[index][1]=='red'):
              return False
          elif(tree[index][1]=='red'):
              if(tree[2*index+1][1]!='black' or tree[2*index+2][1]!='black'):
                  print("PROBLEM HERE")
                  return False
          else:            
              if(2*index+1&lt;len(tree)):
                  isRedBlack(tree,2*index+1)
              if(2*index+2&lt;len(tree)):
                  isRedBlack(tree,2*index+2)
              return True
  
  redBlack = [(3,'black'),(8,'red'),(8,'red'),('EMPTY','black'),('EMPTY','black'),('EMPTY','black'),('EMPTY','red')]
  
  print("IS READBLACK: ",isRedBlack(redBlack,0))
  </code></pre>
  
  <p>The problem is that the code enters the condition when its red but one of its childrens isnt black, so it should return False, but instead of returning False it continues recursing until the end and returns True.</p>