Recursive algorithms anyone?

Nick Perkins nperkins7 at home.com
Tue Jun 12 10:56:35 EDT 2001


"Kirby Urner" <urner at alumni.princeton.edu> wrote in message
...
> E.g.  >>> additem(1,[1,2,[3,4,[5,6]],7])
>       [2,3,[4,5,[6,7]],8]
>



def additem(x):
    if type(x) is type([]): return map(additem,x)
    else: return x+1







More information about the Python-list mailing list