i get different answers based on run platform

John Gordon gordon at panix.com
Thu Jul 7 20:37:54 CEST 2011


In <842fce9d-1b3f-434a-b748-a6dc4828c385 at h12g2000pro.googlegroups.com> linda <postslot at gmail.com> writes:

> I have this simple palindrome program that yields different results
> depending on whether I run it from Windows or from IDLE.  The answer
> is correct off IDLE, but why is this the case?  Here's the code:

Your code contains debugging statements that print the value of the normal
string and the reversed string.  What do those statements print when you
run your program under Windows?  That should go a long way towards telling
you what the problem is.

(Perhaps Windows leaves a linefeed character hanging at the end of the
input line, which upsets the palindromic balance?)

By the way, I could not make your program work as you provided it; I had
to replace input() with raw_input().  Does it really work for you this way?

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list