← Back to challenges

Recursion: String Palindromes

PythonHardrecursionstringsvalidation

Instructions

Write a function that recursively determines if a string is a palindrome.

Examples

is_palindrome("abcba") ➞ True

is_palindrome("b") ➞ True

is_palindrome("") ➞ True

is_palindrome("ad") ➞ False

Notes

An empty string counts as a palindrome.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Explosion Intensity