Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'else:': 0.03; '3.2': 0.05; 'url:bugs': 0.05; 'subject:based': 0.07; 'python': 0.08; 'from:addr:python': 0.09; 'wrote:': 0.15; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'idle,': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'reply-to:addr:python-list': 0.16; 'def': 0.16; 'help.': 0.19; 'header:In-Reply-To:1': 0.22; 'windows': 0.26; 'received:84': 0.28; 'correct': 0.29; 'fixed': 0.29; 'skip:( 20': 0.30; 'yields': 0.30; 'thanks': 0.31; 'print': 0.32; 'break': 0.33; 'to:addr:python-list': 0.34; 'header:User- Agent:1': 0.34; 'reply-to:addr:python.org': 0.35; 'url:python': 0.37; 'but': 0.37; 'using': 0.37; 'url:org': 0.38; 'subject:: ': 0.38; 'run': 0.39; 'skip:s 20': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'your': 0.60; 'training': 0.61; 'results': 0.62; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'case?': 0.84; 'subject:different': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar0HAMT/FU7Unw4S/2dsb2JhbABTmEKOdHeIfcJOhjgEl0OLRQ Date: Thu, 07 Jul 2011 19:54:47 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: i get different answers based on run platform References: <842fce9d-1b3f-434a-b748-a6dc4828c385@h12g2000pro.googlegroups.com> In-Reply-To: <842fce9d-1b3f-434a-b748-a6dc4828c385@h12g2000pro.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310064891 news.xs4all.nl 21783 [2001:888:2000:d::a6]:53431 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9052 On 07/07/2011 19:18, 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:') > 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') > > Thanks for your help. > Try printing ascii(something) too. There's a known bug in Python 3.2 where it leaves a training '\r', if that's what you're using (http://bugs.python.org/issue12435), fixed in Python 3.2.1.