这是一个简单的程序
def is_palindrome_v1(s):
""" (str) --> bool
Return True if and only if s is a palindrome
>>> is_palindrome_v1('noon')
True
>>> is_palindrome_v1('racecar')
True
>>> is_palindrome_v1('dented')
False
""""
return reverse(s) == s
def reverse(s):
""" (str) --> str
Return a reversed version of s
>>> reverse('hello')
'olleh'
>>> reverse('a')
'a'
"""
rev = ""
for ch in s:
rev = ch + rev
return rev
我尝试运行时遇到的错误
"SyntaxError: EOL while scanning string literal"
不确定我从哪里得到这个错误。