Program to count alphabet, number and special sumbols python programt

 """

WAP to count alphabets,numbers and special symbol


"""





str=input("Enter a string:")

c,s,n,symbol=0,0,0,0

for ch in str:

 if ch>='A' and ch<='Z':

  c+=1

 elif ch>='a' and ch<='z':

  s+=1

 elif ch>='1' and ch<='9':

  n+=1

 else:

  symbol+=1

print("There are ",c,"capital letters.","\n There are",s,"small characters.","\n There are ",n,"numbers.","\nThere are",symbol,"special characters.")


No comments:

Powered by Blogger.