21. Problem to check whether the list is palindrome or not.

In this program, we will take a user input as a list and check whether the given list is palindrome or not with the help of the below-given steps.

List is palindrome:

Steps to solve the program
  1. Take a list as input.
  2. Create a variable and assign its value equal to the original list in reverse order.
  3. If both lists are equal then the list is a palindrome, else not.
				
					#Input list
list1 = [2,4,6,6,4,2]

#Creating variable and assign 
# value to it
list2 = list1[::-1]

#Printing output
if list1 == list2:
    print("List is palindrome")
else:
    print("List is not palindrome")
				
			

Output :

				
					List is palindrome
				
			

Related Articles

List of elements divided by a number

List of words which has vowels in string

Leave a Comment