i get different answers based on run platform
linda
postslot at gmail.com
Thu Jul 7 14:18:08 EDT 2011
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.
More information about the Python-list
mailing list