回文判断
课程:Python · 编程练习
Python编程练习 - 回文判断
练习内容
# 判断字符串是否为回文\ndef is_palindrome(text):\n # 转换为小写并去除空格\n cleaned = text.lower().replace(" ", "")\n return cleaned == cleaned[::-1]\n\ndef is_palindrome_two_pointers(text):\n text = text.low
课程:Python · 编程练习
Python编程练习 - 回文判断
# 判断字符串是否为回文\ndef is_palindrome(text):\n # 转换为小写并去除空格\n cleaned = text.lower().replace(" ", "")\n return cleaned == cleaned[::-1]\n\ndef is_palindrome_two_pointers(text):\n text = text.low