SyntaxFix
Write A Post
Hire A Developer
Questions
#compare 1st half with reversed second half # i.e. 'abba' -> 'ab' == 'ba'[::-1] def is_palindrome( s ): return True if len( s ) < 2 else s[ :len( s ) // 2 ] == s[ -( len( s ) // 2 ):][::-1]