Re: [Tutor] printing tree structure

2009-07-03 Thread Dave Angel
karma wrote: Hi all , I have a nested list in the structure [root,[leftSubtree],[RightSubtree]] that I want to print out. I was thinking that a recursive solution would work here, but so far I can't quite get it working. This is what I have so far: Can someone suggest whether this is suited to

Re: [Tutor] printing tree structure

2009-07-03 Thread karma
Thanks all for the feedback. As you all rightly pointed out, I was confusing myself by not keeping a track of the recursion depth. Thanks again 2009/7/3 Alan Gauld : > > "karma" wrote > >> thinking that a recursive solution would work here, but so far I can't >> quite get it working. This is wha

Re: [Tutor] printing tree structure

2009-07-03 Thread Alan Gauld
"karma" wrote thinking that a recursive solution would work here, but so far I can't quite get it working. This is what I have so far: Can someone suggest whether this is suited to a recursive solution and Yes certainly if so, what am I doing wrong. L = ['a', ['b',

Re: [Tutor] printing tree structure

2009-07-03 Thread Lie Ryan
karma wrote: > Hi all , > > I have a nested list in the structure > [root,[leftSubtree],[RightSubtree]] that I want to print out. I was > thinking that a recursive solution would work here, but so far I can't > quite get it working. This is what I have so far: > > Can someone suggest whether this

[Tutor] printing tree structure

2009-07-03 Thread karma
Hi all , I have a nested list in the structure [root,[leftSubtree],[RightSubtree]] that I want to print out. I was thinking that a recursive solution would work here, but so far I can't quite get it working. This is what I have so far: Can someone suggest whether this is suited to a recursive sol