Where is 'palindrome' defined?

David Palao dpalao.python at gmail.com
Mon Jun 1 02:58:10 EDT 2015


Hi,
Because "palindrome" != "parlindrome"?
Have you read the error message? Did you try to understand it?

Best

2015-06-01 6:46 GMT+02:00 fl <rxjwg98 at gmail.com>:
> Hi,
>
> When I search solution of reverse a string/number, I came across a short
> function online:
>
>>>> def palindrome(num):
>         return str(num) == str(num)[::-1]
>
> I thought that it is a general function. And with the following variable:
>
>>>> a
> '1234_5555'
>
>>>> parlindrome(a)
>
> Traceback (most recent call last):
>   File "<pyshell#126>", line 1, in <module>
>     parlindrome(a)
> NameError: name 'parlindrome' is not defined
>
>
> Then, I find that parlindrome is a special checking mirrored word.
> I use Python 2.7.9. Why does the error message show
>
> name 'parlindrome' is not defined
>
>
>
> Thanks,
> --
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list