def isPalindrome(sentence):
str_x = str(sentence)
str_y = ""
for i in str_x:
str_y = i + str_y
if(str_y == str_x):
print("是回文")
else:
print("不是回文")
isPalindrome("121")
有错误请指正
def isPalindrome(sentence):
str_x = str(sentence)
str_y = ""
for i in str_x:
str_y = i + str_y
if(str_y == str_x):
print("是回文")
else:
print("不是回文")
isPalindrome("121")
有错误请指正