Count Uppercase and Lowercase Letters in String
Level 1: Beginner
Project Level 1: Beginner
This project is designed for beginner learners who are still learning and practicing Python fundamentals.
Project Description
This program defines a string, counts how many uppercase and lowercase letters are present, and displays both counts.
How the Project Works
Start your script by defining a sentence as a string. Here is an example:
text = "This Sentence Has Mixed CASE Letters!"Here is how the program behaves when run:
Prerequisites
Required Libraries:
Required Files: No files are required.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
Once you code the project, compare it with our solutions below.





text = "This Sentence Has Mixed CASE Letters!"
uppercount = 0
lowercount = 0
for letter in text:
if letter.isupper():
uppercount += 1
elif letter.islower():
lowercount += 1
print(f"The number of uppercase letters is: {uppercount} ")
print(f"The number of lowercase letters is: {lowercount} ")
text = "This Sentence Has Mixed CASE Letters!"
uppercase_count = sum(1 for c in text if c.isupper())
lowercase_count = sum(1 for c in text if c.islower())
print(f"The number of uppercase letters is: {uppercase_count}")
print(f"The number of lowercase letters is: {lowercase_count}")