Thu Jul 29 2021
Palindrome String
Python Programming1729 views
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
Reference:
Author:Geekboots