[Tutor] Binary Tree Printing Woes
Alan Gauld
alan.gauld@blueyonder.co.uk
Sat Jun 7 15:04:01 2003
> the know and get back to the list with a solution, don't you worry.
Good, I'd look at it myself but have a deadline to meet for Monday!
> > function return a list of values and you then print those
> > outside the function..
> Sorry for screwing up that sentence. *blush* I like the idea of
building
> up a list and return it .... I'm not sure I can handle it
recursively,
>>> def f(aSequence):
retList = []
if len(aSequence) == 0: return [] # terminate condition
else:
retList.append(aSequence[0]) # first elem processing
return retlist + f(aSequence[1:]) # rest of list
>>> newlist = f([1,2,3,4])
>>> print newlist
[1,2,3,4]
As a clue...
Alan g.