Question: In Python: Create a function called countDigits that will count all of the digit variables in a string. Your function should take as an argument

In Python: Create a function called countDigits that will count all of the digit variables in a string. Your function should take as an argument the string to search through. It should return the number of digits that are within the string. For instance, given the following string; string str = "1xyz34abc5"; Your function would return 4 because there are 4 digits in the string. HINT: You should investigate the String.isdigit function. It will simplify your code a great deal.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve the problem of counting the digit characters within a string in Python you can follow these ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!