Python program to calculate the number of digits and letters in a string

0
974
string=input("Please enter string: ")
c1=0
c2=0
for i in string:
      if(i.isdigit()):
            c1=c1+1
      c2=c2+1
print("The number of digits are: ")
print(c1)
print("The number of characters are: ")
print(c2)

     Output 1:
             Please enter string: python1234
             The number of digits are: 
             4
             The number of characters are: 
             10
     Output 2:
             Please enter string: program12345
             The number of digits are: 
             5
             The number of characters are: 
             12

इन्हें भी देखें।

Python Programs के लिये यहाँ click करें।

 

 

 

 

Python program to calculate the number of digits and letters in a string program to calculate the number of digits and letters in a string in python write a python program to calculate the number of digits and letters in a string write a program to calculate the number of digits and letters in a string write a program to calculate the number of digits and letters in a string in python program to calculate the number of digits and letters in a string calculate the number of digits and letters in a string calculate the number of digits and letters in a string in python

 

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here