Checks if a string is a palindrome or not using recursion
Solution :
- Take a specific string from the user.
- Pass the string as an argument to a recursive function.
- In the function, if the length of the string is less than 1, return True, and execute the command.
- 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 last character removed else return False.
- Used an if statement that will go ahead and check if the returned value is True of False and then function will print the final result.
RUNTIME TEST CASES:
Case 1: Enter string:mom String is a palindrome!
Case 2: Enter string:hello String isn't a palindrome!