4 Comments

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")

Expand full comment

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}")

Expand full comment

text = "This Sentence Has Mixed CASE Letters!"

# Set counters

upperCase = 0

lowerCase = 0

# Loop through each letter in the array

for i in text:

# Check if the letter is upper case

if i.isupper():

# If it is add to the upperCase

upperCase += 1

elif i.islower():

# Otherwise add to lowerCase

lowerCase += 1

print(f"The number of upper case letters is {upperCase}")

print(f"The number of upper case letters is {lowerCase}")

Expand full comment

text = "This Sentence Has Mixed CASE Letters!"

upper = 0

lower = 0

for char in text:

if char.isupper():

upper = upper + 1

elif char.islower():

lower = lower + 1

print(f"the number of upper case letters {upper}")

print(f"the number of lower case letters {lower}")

Expand full comment