Skip to content

Latest commit

 

History

History
42 lines (25 loc) · 709 Bytes

Palindrome_Strings.md

File metadata and controls

42 lines (25 loc) · 709 Bytes

CodeWars Python Solutions


Palindrome Strings

A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. This includes capital letters, punctuation, and word dividers.

Implement a function that checks if something is a palindrome.

isPalindrome("anna")   ==> true
isPalindrome("walter") ==> false
isPalindrome(12321)    ==> true
isPalindrome(123456)   ==> false

Given Code

def is_palindrome(string):
    pass

Solution

def is_palindrome(string):
    return str(string) == str(string)[::-1]

See on CodeWars.com