Lad wrote:
> If I have a list
>> Mylist=[1,2,3,4,5]
> I can print it
>> for i in Mylist:
> print i
>> and results is
> 1
> 2
> 3
> 4
> 5
>>> But how can I print it in a reverse order so that I get
> 5
> 4
> 3
> 2
> 1
>>> def printreverse(lst):
if lst:
printreverse(lst[1:])
print lst[:1][0]
>>> printreverse([1,2,3,4])
No good reason at all to do it this way. But recursion is fun.
-Jordan Greenberg
--
Posted via a free Usenet account from http://www.teranews.com