Count lowercase letters in a file
Write a Python program to count lowercase letters in a file.
14
Approach
sum(ch.islower() for ch in text).
Solution
with open("story.txt", "w") as f: f.write("Learn Python At SQA Tools\n") with open("story.txt") as f: print(sum(ch.islower() for ch in f.read()))14
Learn the concept
New to this topic? Read the lesson, then come back.