cumbersome palindromes by cumbersome solution

def why_yes_good_sir_or_madam_this_string_has_brackets_stripped(s):
\x09return s.strip('[]')

def hello_good_sir_or_madam_is_this_list_is_a_palindrome(s):
\x09s = s.split(', ')
\x09return s == s[::-1]

while True:
\x09s = raw_input()
\x09s = why_yes_good_sir_or_madam_this_string_has_brackets_stripped(s)
\x09if hello_good_sir_or_madam_is_this_list_is_a_palindrome(s):
\x09\x09print 'Why, yes, good sir or madam, this list is in fact a palindrome'
\x09elif not hello_good_sir_or_madam_is_this_list_is_a_palindrome(s):
\x09\x09print 'Why, no, good sir or madam, this list is not in fact a palindrome'
\x09else:
\x09\x09print 'Why, hello, good sir or madam, this program appears to be broken'

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page