Palindrome String

 #!/usr/bin/evn python
# Take input from the user
strng = input("Enter your string: ")

# Make it suitable for caseless comparison
strng = strng.casefold()

# Reverse the string
revStrng = reversed(strng)

# Check if the string is equal to its reverse
if list(strng) == list(revStrng):
   print("It is palindrome")
   print("It is not palindrome")

#***** Output *****
Enter your string: asdfaw
It is not palindrome

# or

Enter your string: abcdcba
It is palindrome

Recommended for you