I've written the following program in Python, it is supposed to use only recursion to output whether or not the number of parentheses is even. For example:
nestParen("(())") --> true
nestParen("(((x))") --> false
Below is the code from my program. For some reason, it always returns true. Why is this and how can it be fixed? Thank you!
def nestParen(string1, max = 0, min = 0): 
    if max == 0:
        max = len(string1) - 1
    checker = False
    if max > min:
        if string1[max] == ")" and string1[min] == "(":
            checker = True
            min = min + 1
            max = max - 1
            if max > min:
                nestParen(string1, max, min)
                print checker
    return checker
nestParen("(((x))")
 
     
    