Write a recursive function named count_non_digits (word) which takes a string as a parameter and returns the number of non-digits in the parameter string. The function should return 0 if the parameter string contains only digits. Note: you may not use loops of any kind. You must use recursion to solve this problem. You can assume that the parameter string is not empty. For example: Test Result print(count_non_digits('123')) print(count_non_digits('2rPTy5')) print(count_non_digits('hello world')) 11 Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Precheck Check
Write a recursive function named count_non_digits (word) which takes a string as a parameter and returns the number of non-digits in the parameter string. The function should return 0 if the parameter string contains only digits. Note: you may not use loops of any kind. You must use recursion to solve this problem. You can assume that the parameter string is not empty. For example: Test Result print(count_non_digits('123')) print(count_non_digits('2rPTy5')) print(count_non_digits('hello world')) 11 Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Precheck Check
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
Related questions
Question
![Question 1
Not complete
Marked out of
1.00
Flag question
Write a recursive function named count_non_digits (word) which takes a string as a parameter and returns the number of non-digits in the parameter string. The function should return 0 if the
parameter string contains only digits.
Note: you may not use loops of any kind. You must use recursion to solve this problem. You can assume that the parameter string is not empty.
For example:
Test
Result
print(count_non_digits ('123'))
print(count_non_digits ('2rPTy5'))
print(count_non_digits ('hello world')) 11
Precheck Check
0
4
Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %)
1](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fda0be02e-f777-40ec-8b6c-8836435acb5a%2F6efa9792-ad32-4223-83b7-284f33d53af5%2Fm3a0jj_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Question 1
Not complete
Marked out of
1.00
Flag question
Write a recursive function named count_non_digits (word) which takes a string as a parameter and returns the number of non-digits in the parameter string. The function should return 0 if the
parameter string contains only digits.
Note: you may not use loops of any kind. You must use recursion to solve this problem. You can assume that the parameter string is not empty.
For example:
Test
Result
print(count_non_digits ('123'))
print(count_non_digits ('2rPTy5'))
print(count_non_digits ('hello world')) 11
Precheck Check
0
4
Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %)
1
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning