Palindrome
Pierre Quentel
quentel.pierre at wanadoo.fr
Thu Nov 13 11:01:35 EST 2003
To remove the characters that are not alphanumeric I would have used
filter :
t=filter(lambda x: x.isalnum(),list(s.lower()))
Pierre
--- In python-list at yahoogroups.com, runic911 at a... (Runic911) wrote:
> Does anyone know how i can fix my Palindrome program?
>
> s = raw_input('Enter a String: ')
> punctuation = '%$!*.,-:? ;()\'\"\\'
> i = 0
> h = 0
> t = 0
> p = ''
> z = 0
> while s!= ' ':
> while i <= len(s) - 1:
> punct = s[i]
> if punctuation.find(punct) == -1:
> p = p + punct
> i = i + 1
> t = p.lower()
> t[h] == t[len(t)-1-h]
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list