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')
palindrome('banana')
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')
palindrome('banana')