#!/usr/bin/env python s = raw_input("Please enter a string: ") z = [x for x in s] z.reverse() if s == "".join(z): print "The string is a palindrome" else: print "The string is not a palindrome"
[kd@kdlappy book]$ ./palindrome.py Please enter a string: madam1 The string is not a palindrome [kd@kdlappy book]$ ./palindrome.py Please enter a string: madam The string is a palindrome