filmov
tv
Python Program to count total number of uppercase, lowercase, digits and special character

Показать описание
#Program to count total number of uppercase, lowercase, digits and special character
words = "My Phone No is #982736227321 and I Scored 98% marks"
noOfUppercase = 0
noOfLowercase = 0
noOfDigits = 0
noOfSpecial = 0
noOfSpace = 0
for ch in words:
if isSpace is True:
noOfSpace = noOfSpace + 1
if isLowercase is True:
noOfLowercase = noOfLowercase + 1
if isUppercase is True:
noOfUppercase = noOfUppercase + 1
if isDigits is True:
noOfDigits = noOfDigits + 1
if isSpecial is False:
noOfSpecial = noOfSpecial + 1
noOfSpecial = noOfSpecial - noOfSpace
totalNoOfChars = len(words) - noOfSpace
print("Total No Of Characters: ", totalNoOfChars)
print("No Of Upper Case Characters: ", noOfUppercase)
print("No Of Lower Case Characters: ", noOfLowercase)
print("No Of Digits: ", noOfDigits)
print("No Of Special: ", noOfSpecial)
words = "My Phone No is #982736227321 and I Scored 98% marks"
noOfUppercase = 0
noOfLowercase = 0
noOfDigits = 0
noOfSpecial = 0
noOfSpace = 0
for ch in words:
if isSpace is True:
noOfSpace = noOfSpace + 1
if isLowercase is True:
noOfLowercase = noOfLowercase + 1
if isUppercase is True:
noOfUppercase = noOfUppercase + 1
if isDigits is True:
noOfDigits = noOfDigits + 1
if isSpecial is False:
noOfSpecial = noOfSpecial + 1
noOfSpecial = noOfSpecial - noOfSpace
totalNoOfChars = len(words) - noOfSpace
print("Total No Of Characters: ", totalNoOfChars)
print("No Of Upper Case Characters: ", noOfUppercase)
print("No Of Lower Case Characters: ", noOfLowercase)
print("No Of Digits: ", noOfDigits)
print("No Of Special: ", noOfSpecial)