大文字を小文字に変換したうえで逆順に並べ替えて元の文字列と比較する。
isPalindrome.vi - Google ドライブ
def isPalindrome(s): s = s.lower() return s == s[::-1] print(isPalindrome("Otto"))
function isPalindrome(s) ---[[ local s = string.lower(s) return s == string.reverse(s) --]] --[[ local s = s:lower() return s == s:reverse() --]] end print(isPalindrome("Otto"))