Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def uppercase_lowercase_count(text = "This Sentence Has Mixed CASE Letters!"):
- uppercase_count = 0
- lowercase_count = 0
- for char in text:
- if char.isalpha() and char.isupper(): # Check for upper characters and alphabetic characters only
- uppercase_count = uppercase_count + 1
- elif char.isalpha() and char.islower(): # Check for upper characters and alphabetic characters only
- lowercase_count = lowercase_count + 1
- return uppercase_count, lowercase_count
- # Function call and result display
- uppercase_count, lowercase_count = uppercase_lowercase_count()
- print(f"The number of uppercase letter is: {uppercase_count}")
- print(f"The number of lowercase letter is: {lowercase_count}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement