Python Program to print a list in reverse order


In this program, You will learn how to print a list in reverse order in Python.


name = [10, "China", 20, "Aus", "Uk"]

List in reverse order = Uk Aus 20 China 10

Example: How to print a list in reverse order in Python

name = []
print("Enter how many elements:", end="")
n = int(input())

print("Enter elements:", end="")

for i in range(0, n):
    num = input()

    name.append(num)

print("List in reverse order:", end="")

for i in range(n-1,-1,-1):
    print(name[i], end=" ")

Output:

Enter how many elements:4
Enter elements:11
12
13
14
List in reverse order:14 13 12 11