more newbie help needed

Fredrik Lundh fredrik at pythonware.com
Mon Nov 14 14:49:34 EST 2005


Steve Holden wrote:

> Note, however, that there are more pythonic ways to perform this task.
> You might try:
>
> for index in range(len(fruit)):
>   letter = fruit[-index-1]
>   print letter
>
> as one example. I'm sure other readers will have their own ways to do
> this, many of them more elegant.

looks like you've missed some recent additions:

    for char in reversed(fruit):
        print char

</F> 






More information about the Python-list mailing list