top of page
Click here to go to the home page of AskTheCode.

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

Team ATC

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")

Recent Posts

See All

Comments


bottom of page