Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9051
| Date | 2011-07-07 11:58 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: i get different answers based on run platform |
| References | <842fce9d-1b3f-434a-b748-a6dc4828c385@h12g2000pro.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.759.1310064169.1164.python-list@python.org> (permalink) |
linda wrote:
> 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:
>
> def reverse(text):
> return text[::-1]
> def is_palindrome(text):
> return text==reverse(text)
> while True:
> something=input('enter text:')
try changing this to:
something = input('enter text:').rstrip('\n')
> print(something)
> print(something[::-1])
> if (is_palindrome(something)):
> print("yes, it is a palindrome")
> break
> else:
> print("no, it is not a palindrome")
> continue
> print ('done')
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
i get different answers based on run platform linda <postslot@gmail.com> - 2011-07-07 11:18 -0700
Re: i get different answers based on run platform John Gordon <gordon@panix.com> - 2011-07-07 18:37 +0000
Re: i get different answers based on run platform Ethan Furman <ethan@stoneleaf.us> - 2011-07-07 12:11 -0700
Re: i get different answers based on run platform MRAB <python@mrabarnett.plus.com> - 2011-07-07 19:59 +0100
Re: i get different answers based on run platform linda <postslot@gmail.com> - 2011-07-07 14:09 -0700
Re: i get different answers based on run platform Ethan Furman <ethan@stoneleaf.us> - 2011-07-07 14:42 -0700
Re: i get different answers based on run platform linda <postslot@gmail.com> - 2011-07-07 14:37 -0700
Re: i get different answers based on run platform Ethan Furman <ethan@stoneleaf.us> - 2011-07-07 11:58 -0700
Re: i get different answers based on run platform MRAB <python@mrabarnett.plus.com> - 2011-07-07 19:54 +0100
csiph-web