Ask Your Question

Revision history [back]

click to hide/show revision 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