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
To solve the problem of counting the digit characters within a string in Python you can follow these ... View full answer
Get step-by-step solutions from verified subject matter experts
