[Tutor] flatten a tuple

alan.gauld@bt.com alan.gauld@bt.com
Thu, 19 Apr 2001 16:38:25 +0100


> So I have a tuple:
> 
> ((0, 1, 2), (3,4,5), (6,7,8))
> 
> and I want to get:
> 
> (6,7,8,3,4,5,0,1,2)

Go to my web tutor, look thru' the topic on recursion.
In there, there is a recursive function for printing 
a list of arbitrary complexity in a flattened format.

Convert the tuples to lists and change the print 
statements to result.append() and you should have 
most of your solution.

HTH

Alan G