Python Programming
Palindrome String
Python programming for checking palindrome string with the help of casefold reversed and list
By Geekboots
7/29/2021
0 views
palindrome-string.pyPython
#!/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
pythonpython programmingcodingpalindrome stringcasefold()reversed()list()