def acceptable(s=' ')
b = s.count('x')
c = s.count('o')
if b == c:
return True
else:
return False
def HT(n, s='', result=[]):
if n == 0:
result.append(s)
elif n > 0:
for c in [ 'x', 'o' ]:
result = HT(n-1, s+c, result)
return result
def main():
n = 4
for s in HT(n):
print s
main()'
i'm having a problem of where to call my first function in the second function. The program is supposed to display xxxx, xxxo, xxoo (ect until all have possibilities have been exhausted). acceptable is supposed to only make it display the the ones where there are equal amount of x's and o's. But since my professor used recursion in the code he gave us in the second function, I don't know where to place the call for the first function to not display certain lines of code, because wherever I put it, it doesn't work.
Thanks in advance for any help.