Python Practice › If-Else Programs › Program 24
Check a lowercase character
Write a Python program to check whether a character is lowercase.
Input
"c", "Q"
Output
c True Q False
Approach
- Use
islower(), or compare with the range “a” to “z”.
Solution
for ch in ["c", "Q"]: if "a" <= ch <= "z": print(ch, True) else: print(ch, False)Output
c True Q False
Line by line
Line 2
Characters compare by their Unicode order, so a chained comparison checks the a-z range. ch.islower() works too and also handles non-English letters.
Learn the concept
New to this topic? Read the lesson, then come back.