11.palindrome

Checks if the string entered by the user is a palindrome. That is that it reads the same forwards as backwards like “racecar”

def palindrome(string):
    return string == string[::-1]
palindrome('racecar')
True
palindrome('banana')
False

def palindrome(string):

    if string == string[::-1]:
        print('The given string is a palindrome')
    else:
        print('The given string is not a palindrome')
palindrome('racecar')
The given string is a palindrome

palindrome('banana')
The given string is not a palindrome