You want to avoid importing any modules in Python. You want to have a way to test if a string is a palindrome is four lines of code. What do you do?
def is_palindrome_pythonic(s): return all(a == b for a, b, in zip( map(str.lower, filter(str.isalnum, s)), map(str.lower, filter(str.isalnum, reversed(s))))) # The above four lines of code were taken from page 78 of Elements of Programming Interviews in Python. print(is_palindrome_pythonic("aaaabaabaa"))