About 372,000 results
Open links in new tab
  1. 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 …

  2. Python reverse() for palindromes - Stack Overflow

    Dec 19, 2016 · Try this code: def palindrome(string): i = 0 while i < len(string): if string[i] != string[(len(string) - 1) - i]: return False i += 1 return True print palindrome("hannah")

  3. python - How to check if a string is a palindrome ... - Stack Overflow

    I have a code to check whether a word is palindrome or not: if str[index] == str[p]: index = index + 1. p = p-1. print("String is a palindrome") break. else: print("string is not a palindrome")

  4. Python Programs To Check Whether A String Is Palindrome ... - Python

    Jan 31, 2024 · This article explains how to write Python programs to check whether a string is palindrome or not using methods like for loop, while loop, string slicing, etc with examples.

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

    Oct 6, 2021 · Learn how to use Python to check if a string is a palindrome, using string indexing, for loops, the reversed function in Python!

  6. Python Program to Check Whether a String is Palindrome or Not

    # Program to check if a string is palindrome or not my_str = 'aIbohPhoBiA' # make it suitable for caseless comparison my_str = my_str.casefold() # reverse the string rev_str = …

  7. 7 Ways to Solve Palindrome Python Programs

    Jul 13, 2020 · Checking Whether a String is a Palindrome in Python; 1. Check Palindrome Using Slicing in Python; 2. Check Palindrome Using Loop In Python; 3. Check Palindrome Using …

  8. Check If a String Is Palindrome in Python - Online Tutorials …

    Given a string, our task is to check weather this string is palindrome or not. Step1: Enter string as an input. Step2: Using string slicing we reverse the string and compare it back to the original …

  9. python - Checking Palindrome text, with ignored punctuation …

    Jun 1, 2015 · def reverse(text): return text[::-1] def is_palindrome(text): return text == reverse(text) something = input('Enter text: ') if (is_palindrome(something)): print("Yes, it is a palindrome") …

  10. How to Check if a Python String is a Palindrome - Shiksha

    Sep 6, 2024 · Below, we have discussed different ways in which you can check whether a string is a palindrome or not. Methods to Check if a String is a Palindrome. Method 1 – Using the …

Refresh