Recursive Python program to test if a string is a palindrome or not.

Karthika A
Guvi
Published in
1 min readDec 19, 2019

Problem Description

The program takes a string and checks whether a string is a palindrome or not using recursion.

Problem Solution

Take a string from the user.
2. Pass the string as an argument to a recursive function.
3. In the function, if the length of the string is less than 1, return True.
4. If the last letter is equal to the first letter, recursively call the function with the argument as the sliced list with the first character and the last character removed else return False.
5. Use an if statement if check if the returned value is True of False and print the final result.

--

--