
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python program to print the elements of an array in reverse order
When it is required to print the elements of an array in reverse order, the list can be iterated over from the end.
Below is a demonstration of the same −
Example
my_list = [21, 32, 43, 54, 75] print("The list is : ") for i in range(0, len(my_list)): print(my_list[i]) print("The list after reversal is : ") for i in range(len(my_list)-1, -1, -1): print(my_list[i])
Output
The list is : 21 32 43 54 75 The list after reversal is : 75 54 43 32 21
Explanation
A list is defined, and is displayed on the console.
The list is iterated over, and displayed.
It is reversed by iterating it from the last element.
Every element is displayed on the console.
- Related Articles
- How to print the elements in a reverse order from an array in C?
- Python program to print the duplicate elements of an array
- Python program to sort the elements of an array in ascending order
- Python program to sort the elements of an array in descending order
- C program to reverse an array elements
- How to print one dimensional array in reverse order?
- C++ program to reverse an array elements (in place)
- Program to print matrix elements in spiral order in python
- Python program to print the elements of an array present on odd position
- Python program to print the elements of an array present on even position
- Print the last occurrence of elements in array in relative order in C Program.
- Golang Program To Sort The Elements Of An Array In Ascending Order
- Golang Program To Sort The Elements Of An Array In Descending Order
- Swift Program to Sort the Elements of an Array in Ascending Order
- Swift Program to Sort the Elements of an Array in Descending Order

Advertisements