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')
--
http://mail.python.org/mailman/listinfo/python-list