HOME/Articles/

python code check palindrome (snippet)

Article Outline

Python example 'python code check palindrome'

Functions in program:

  • def palindrome(string):

python code check palindrome

Python code example: python code check palindrome

#Check if a string is a palindrome

def palindrome(string):
    return string == string[::-1]
palindrome('python')
#palindrome mean a words or phrase or sequence that reads the same backwards as forwards

More Python: https://pythonprogramminglanguage.com