About 109,000 results
Open links in new tab
  1. Recursive Function palindrome in Python - Stack Overflow

    If a string has the first and last letters the same, and the remaining letters (I think it's a [1: -1] slice in Python, but my Python is a bit rusty) are a palindrome, it's a palindrome. Now, write that as a palindrome function that takes a string.

  2. Recursive function to check if a string is palindrome

    Aug 21, 2022 · Given a string, write a recursive function that checks if the given string is a palindrome, else, not a palindrome. Examples: malayalam. Reverse of max is not max. We have discussed an iterative function here. The idea of a recursive function is simple: return true. and recur for remaining substring. Below is the implementation of the above idea:

  3. Python Program to Check if a String is Palindrome or Not

    Feb 21, 2025 · The task of checking if a string is a palindrome in Python involves determining whether a string reads the same forward as it does backward. For example, the string “madam” is a palindrome because it is identical when reversed, whereas “hello” is not.

  4. 5 Best Ways to Check for Palindromes in Python Using Recursion

    Mar 7, 2024 · Method 1 involves a classical recursive function to check if a string is a palindrome. It compares the first and last characters of the string, then proceeds to the next pair, moving inward, by recursively calling itself with a substring excluding these characters.

  5. Palindrome in Python using recursion – allinpython.com

    python program to check for a palindrome string using recursion: if S[L] != S[R] -->false, L >= R --> true, recursive function is_palindrome(L+1, R-1, S)

  6. python: recursive check to determine whether string is a palindrome

    Jul 16, 2012 · def is_palindrome(s): if not s: return True else: return s[0]==s[-1] and is_palindrome(s[1:-1]) or, if you want a one-liner: def is_palindrome(s): return (not s) or (s[0]==s[-1] and is_palindrome(s[1:-1]))

  7. Python Recursive Function Check Palindrom String

    Mar 20, 2020 · Python Recursive Function Check Palindrom String : Input a string and this Python program will use a recursie function to check for palindrome string.

  8. Python Program to Check whether a String is Palindrome or not …

    Here is source code of the Python Program to check whether a string is a palindrome or not using recursion. The program output is also shown below. if len(s) < 1: return True else: if s [0] == s [- 1]: return is_palindrome (s [1:- 1]) else: return False . print("String is a palindrome!") else: print("String isn't a palindrome!") 1.

  9. Python Program to Check If a String is a Palindrome (6 Methods)

    Oct 6, 2021 · In this post, you learned a number of different ways to check if a Python string is a palindrome. You learned how to do this with Python string indexing, the Python reversed() function, both for and while loops. You also learned how to check if a number is a Python palindrome and how to search a larger string for a substring that is a palindrome.

  10. Python Check Palindrome using Recursive function

    The following code uses a recursive function to determine whether or not a string is a palindrome. The empty string is a palindrome, as is any string containing only one character. Any longer string is a palindrome if its first and last characters match, and if the string formed by removing the first and last characters is also a palindrome.

  11. Some results have been removed