Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Exercise Example 32

Python Exercise Example 32

Python 100 Examples Python 100 Examples

**Question:** Output the values of a list in reverse order.

**Analysis:** None.

Program source code:

Example

#!/usr/bin/python

-- coding: UTF-8 --

a

=

[

'

one

'

,

'

two

'

,

'

three

'

]

for

i

in

a

[

::-

1

]

:

print

(

i

)

The output of the above example is:


three
two
one

Python 100 Examples Python 100 Examples