I having been impoving myself in Python for a while. I executed this code but never seem to get either True or False for my output which I actually require.
def cathat(str,cat,hat):
    #print("Cat: {} Hat: {} Strlen: {}".format(cat,hat,len(str)))
    if len(str) is 0:
        if cat == hat:
            print("True") #For debugging purpose
            return True
        else:
            print("False") #For debugging purpose
            return False
    else:
        if str.startswith("cat"):
            cathat(str[3:],cat + 1,hat)
        elif str.startswith("hat"):
            cathat(str[3:],cat,hat + 1)
        else:
            cathat(str[1:],cat,hat)
            
def cat_hat(str):
  return cathat(str, 0, 0)
For Input:
2
catinahat
bazingaa
Your Output is:
True
None
True
None
Expected Output is:
True
True
 
     
    