Where is 'palindrome' defined?
Omar Abou Mrad
omar.aboumrad at gmail.com
Mon Jun 1 03:00:33 EDT 2015
On Mon, Jun 1, 2015 at 7:46 AM, fl <rxjwg98 at gmail.com> wrote:
> 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
>
> <snip>
Further to the mentioned, be careful with your spelling, the function name
as you've shown is "palindrome" but you're invoking it using "parlindrome".
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150601/c264c6b2/attachment.html>
More information about the Python-list
mailing list