+ -
当前位置:首页 → 问答吧 → 求助-python初学者问题

求助-python初学者问题

时间:2011-07-10

来源:互联网

Python code

def reverse(text):
    return text[::-1]

def is_palindrome(text):
    return text == reverse(text)

userInput = input('please input something...')

#why does is_palindrome function always return false??
if(is_palindrome(userInput)):
    print('is palindrome')
else:
    print('not palindrome')



问题再注释中,为什么无论输入什么,程序最后都输出not palidrome

作者: shihang_apo   发布时间: 2011-07-10

忘记说谢谢。补上。

作者: shihang_apo   发布时间: 2011-07-10