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!"
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}")
lower = 0
upper = 0
for letter in word:
if letter.isupper():
upper +=1
elif letter.islower():
lower +=1
print(f"word has {lower} lower letters")
print(f"word has {upper} upper letters")