19 Program to reverse a list using Python

Program:

l = list()

l = [x for x in input("Enter any 5 value: ").split()]



length = len(l)

print("Reverse List:",end=" ")

for i in range(length-1,-1,-1):

    print(l[i],end=" ")


Output:

Program to reverse a list using Python

Previous
Next Post »