The Tech Platform

Dec 14, 20211 min

Program to Reverse a List in Python

Updated: Dec 16, 2021

This python program allows user to enter the length of a List.

Code:

NumList = []
 

 
Number = int(input("Total Number of List Elements: "))
 
for i in range(1, Number + 1):
 
value = int(input("Element %d : " %i))
 
NumList.append(value)
 

 
NumList.reverse()
 
print("\nThe Result of a Reverse List = ", NumList)

Output:

Read More:

The Tech Platform

www.thetechplatform.com

    0