Sunday, March 3, 2019

Reverse the elements - Python3

a=[]
n=int(input("Enter the size of list:"))
for i in range(n) :
    x=int(input("Enter the value: "))
    a.append(x);
print(a)
a.reverse()
print("Reversed list:" +str(a))

ScreenShot:


No comments:

Post a Comment