I’m just a newbie on Python.
I have this algorithm to see is a word is a palindrome or not.
def isPalindrome(s):
def toChars(s):
s = s.lower()
ans = ''
for c in s:
if c in 'abcdefghijklmnopqrstuvwxyz':
ans = ans + c
return ans
def isPal(s):
if len(s) <= 1:
return True
else:
return s[0] == s[-1] and isPal(s[1:-1])
return isPal(toChars(s))
And I want to implement something like this:
s=str(raw_input('Enter a word with quotes: '))
I want to be asked for entering a word, because now, the only way to run my code is to call it in a shell.
P.S.: Sorry for my English.
The following will do it (without quotes — I am not sure why you’d want them):