1 | initial version |
Hi, I have used a Boolean to distinguish the states: 'a'=True and 'b'=False.
@cached_function def recur(string,initial_state):
if string=='': return ''
else:
start=eval(string[0])
return str((initial_state+start)%2)+recur(string[1:],start)
Does this answer your question? Roland