Python Program to Check Whether a String is Palindrome or Not


Topic: Python Program to Check Whether a String is Palindrome or Not

Solution

my_str = 'aIbohPhoBiA'
my_str = my_str.casefold()
rev_str = reversed(my_str)
if list(my_str) == list(rev_str):
   print("The string is a palindrome.")
else:
   print("The string is not a palindrome.")



List all Python Programs