
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Program to check string is palindrome with lowercase characters or not in Python
Suppose we have alphanumeric string s. It can hold both uppercase or lowercase letters. We have to check whether s is a palindrome or not considering only the lowercase alphabet characters.
So, if the input is like s = "rLacHEec0a2r8", then the output will be True because the string contains "racecar" in lowercase, which is a palindrome.
To solve this, we will follow these steps −
x := blank string
for each character i in s, do
if i is in lowercase, then
x := x concatenate i
return true when x is palindrome, otherwise false
Example
Let us see the following implementation to get better understanding
def solve(s): x = "" for i in s: if i.islower(): x += i return x == x[::-1] s = "rLacHEec0a2r8" print(solve(s))
Input
"rLacHEec0a2r8"
Output
True
- Related Articles
- Program to check string is palindrome or not with equivalent pairs in Python
- Program to check a string is palindrome or not in Python
- Python program to check if a string is palindrome or not
- C# program to check if a string is palindrome or not
- Python Program to Check Whether a String is a Palindrome or not Using Recursion
- Program to check two parts of a string are palindrome or not in Python
- Program to check a number is palindrome or not without help of a string in Python
- How to Check Whether a String is Palindrome or Not using Python?
- Python program to check whether the string is Symmetrical or Palindrome
- Check if any anagram of a string is palindrome or not in Python
- Program to check minimum number of characters needed to make string palindrome in Python
- Program to check whether palindrome can be formed after deleting at most k characters or not in python
- Program to check the string is repeating string or not in Python
- Python Program to Check String is Palindrome using Stack
- Program to check given string is pangram or not in Python

Advertisements