![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements