Check whether a list is palindrome or not. Also print the reverse list.

Asked: Anonymously |Category: Python

n = eval(input("Enter the no. of elements you want."))

l1 = list()

l2 = list()

for i in range(n):

l1.append(eval(input("Enter the element for first list:")))

l2=l1[::-1]

print(l2)

if(l2==l1):

print("Palindrome")

else:

print("Not Palindrome")

8 views0 comments

Recent Posts

See All

Binary string reduction in Python

Asked: Sudeep |Category: Python x=int(input("Enter the value of x : ")) for i in range(x): n=int(input("Enter the value of n : ")) y=input("Enter the value of y : ") l=list(y) k=0

"Believe you can and you're halfway there"