You can make use of the reversed
function for this as:
>>> array=[0,10,20,40]
>>> for i in reversed(array):
... print(i)
Note that reversed(...)
does not return a list. You can get a reversed list using list(reversed(array))
.
You can make use of the reversed
function for this as:
>>> array=[0,10,20,40]
>>> for i in reversed(array):
... print(i)
Note that reversed(...)
does not return a list. You can get a reversed list using list(reversed(array))
.