Program - Counting total Digits in a string


Topic: Program - Counting total Digits in a string

Solution

str1 = "abc4234AFde"
digitCount = 0
for i in range(0,len(str1)):
  char = str1[i]
  if(char.isdigit()):
    digitCount += 1
print('Number of digits: ',digitCount)



List all Python Programs