└── palindrome /palindrome: -------------------------------------------------------------------------------- 1 | # Program to check if a string is palindrome or not 2 | 3 | my_str = 'aIbohPhoBiA' 4 | 5 | # make it suitable for caseless comparison 6 | my_str = my_str.casefold() 7 | 8 | # reverse the string 9 | rev_str = reversed(my_str) 10 | 11 | # check if the string is equal to its reverse 12 | if list(my_str) == list(rev_str): 13 | print("The string is a palindrome.") 14 | else: 15 | print("The string is not a palindrome.") 16 | --------------------------------------------------------------------------------