|   | 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
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.