# Problem 34

### 8 comments on “Problem 34”

• Varun

def Count(str):
upper, lower, number, special,space = 0, 0, 0, 0, 0
for i in range(len(str)):
if str[i].isupper():
upper += 1
elif str[i].islower():
lower += 1
elif str[i].isdigit():
number += 1
elif str[i] == ” “:
space+=1
else:
special += 1
print(‘Upper case letters:’, upper)
print(‘Lower case letters:’, lower)
print(‘Number:’, number)
print(‘Special characters:’, special)
print(‘Space:’, space)

# Driver Code
str = “#namesIS 00 7 ”
Count(str)

• Vijaykumar

import string
st= input(“Enter a string: “)
count=0
flag=0
di=0
sp=0
po=0
for i in st:
for j in i:
if(j.isupper()):
count+=1
if(j.islower()):
flag+=1
if(j.isdigit()):
di+=1
if(j==’ ‘):
sp+=1
if j in string.punctuation:
po+=1
print(f”lowercase letters: {flag}\nUpper case letters: {count}\nNo.of digits: {di}\nNo. of spaces: {sp}\nNo. of punctuation: {po}”)

• Kritika

def unique_count():
string=input(“Enter combo of digits character and spaces”)
nupper=0
nlower=0
ndigit=0
nspace=0
npunct=0

for i in range(len(string)):
if(string[i].isupper()):
nupper+=1

elif(string[i].islower()):
nlower+=1
elif(string[i].isdigit()):
ndigit+=1
elif(string[i].isspace()):
nspace+=1
else:
npunct+=1

print(f”No of upper case is {nupper} ,No of lower case is {nlower} ,No of digit is {ndigit} , No of spaces is {nspace} ,No of punct is {npunct}”)

unique_count()

• amit

#include
#include

int main()
{
char arr[]=”Amit Tikhe 1010″;
int digit=0;
int upper=0;
int lower=0;
printf(“%s”,arr);
for(int i=0;i=48 && arr[i]=65 && arr[i]=97 && arr[i]<=122)
lower++;

}
printf("\n");
printf("%d %d %d",digit,upper,lower);

return 0;
}

• ARVIND

def check(n):
lower=0
upper=0
digit=0
space=0
special=0
for i in range(len(n)):
if n[i].isupper():
upper+=1
elif n[i].islower():
lower+=1
elif n[i].isdigit():
digit+=1
elif n[i]==’ ‘:
space+=1
else :
special+=1
print(lower,upper,digit)
print(‘Upper Letter:’,upper, ‘lower’,lower )
print(digit)
print(space)
print(special)
n=input()
(check(n))

• ARVIND

#Please refer this code, previous one has some mistakes
def check(n):
lower=0
upper=0
digit=0
space=0
special=0
for i in range(len(n)):
if n[i].isupper():
upper+=1
elif n[i].islower():
lower+=1
elif n[i].isdigit():
digit+=1
elif n[i]==’ ‘:
space+=1
else :
special+=1
print(lower)
print(upper)
print(digit)
print(space)
print(special)
n=input()
(check(n))

• VIVEK KUMAR

#Python
words=input(“Enter the sentence”)
c=0
u=0
l=0
for i in words:
if i.isupper():
u=u+1

elif i.islower():
l=l+1
else:
c=c+1
print(‘Speial char is {}’.format(c))
print(‘Lower case is {}’.format(l))
print(‘Upper case is {}’.format(u))

• Gunjan

a=input()
b=0
c=0
e=0
f=0
for i in a:
if i.islower():
b+=1
elif i.isupper():
c+=1
elif i.isdigit():
e+=1
elif i==’_’:
f+=1
print(‘lower= ‘,b,’upper= ‘,c,’digit= ‘,e,’space= ‘,f)
By_gunjan soni