import sys while 1: string = raw_input("Enter the potential palindrome you want to test ('quit' to exit)\n: ") if string == "quit": sys.exit(0) teststring = string.replace(' ', '') revString = "" for i in range(len(teststring)-1 , -1, -1): revString += teststring[i] if revString == teststring: print string + " is a palindrome\n" else: print string + " is NOT a palindrome\n"