def is_palindrome(s):
# 将字符串转换为小写并去除空格
s = s.lower().replace(" ", "")
# 反转字符串
s = s[::-1]
# 判断是否为回文字符串
return s == s[::-1]
s = "abcdefedcba"
is_palindrome(s)
生活、成长记录
def is_palindrome(s):
# 将字符串转换为小写并去除空格
s = s.lower().replace(" ", "")
# 反转字符串
s = s[::-1]
# 判断是否为回文字符串
return s == s[::-1]
s = "abcdefedcba"
is_palindrome(s)