In this program that I wrote will ask the user to give a string which contains a digits and then the program will count the number of digits in a giving string or sentence using Python programming language. I am using Pycharm as my text editor in writing this program. I hope you will learn something in this sample program.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following,, and

My mobile number here in the Philippines is 09173084360.

Program Listing

# Jake Rodriguez Pomperada, MAED-IT, MIT
# and
# Bacolod City, Negros Occidental
print("\tCount Digits in Python")
val_str = input('Give a String : ')

count = 0
for char in val_str:
    if char.isdigit():
        count += 1
print(f"Number of Digits:  {count}")
print("\tEnd of Program")

Leave a Reply

Your email address will not be published.