Computer Science, asked by SSSK420, 4 months ago

Write a program to check number of uppercase, lowercase and digits

in a given string.

Answers

Answered by mk829119
0

Answer:

x=str(input("enter a string:"))

upper=0

lower=0

digit=0

for i in range(0,len(x)):

if x[i].isupper():

upper+=1

elif x[i].islower():

lower+=1

elif x[i].isdigit():

digit+=1

else:

pass

print(upper,lower,digit)

Answered by jai696
1

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

def count_case(s):

obj = {"upper": 0, "lower": 0, "digits": 0}

for c in s:

if c.isdigit():

obj["digits"] += 1

if c.isupper():

obj["upper"] += 1

if c.islower():

obj["lower"] += 1

return obj

s = input("enter string: ")

for k, v in count_case(s).items():

print(f"{k}: {v}")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions