Thu Jul 29 2021

Palindrome String

File Name: palindrome-string.py

#!/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")
else:
   print("It is not palindrome")
   


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

# or

# Enter your string: abcdcba
# It is palindrome

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.