David Palao <dpalao.pyt...@gmail.com>:

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

When you are starting with any new thing, even the simplest problems
look baffling. Once you have achieved a few successes, such error
messages start to make sense.

>>>>> def palindrome(num):
>>         return str(num) == str(num)[::-1]

BTW, this simplistic function is not very practical for serious,
real-life palindromes. It does work for the naïve Finnish palindrome:

    saippuakauppias
    (= "a soap merchant")

However, it fails to detect:

    innostunut sonni
    (= "an enthusiastic bull")

let alone:

    Sota-apina nakataan raastimeen.
          Apelle pane emit.
      Saarnaa takanani paatos.

    (= "The war monkey will be chucked into a grater.
        Hand the pistils to father-in-law.
        Pathos does preach behind me.")


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to