In python, The function count_contains_x takes a list of strings (wordList) and returns the count of how many strings in the list contain at least one upper- or lower-case 'x'. Hint: Use the accumulator pattern to accumulate the count. Hint: You might want to use the string method count. For example: Test Result strlist = ["xerox", "OXEN", "whiffleball", "XOXOX"] print(count_contains_x(strlist)) 3 fish = ["angel", "gold", "cat", "puffer", "damsel"] print(count_contains_x(fish)) 0 strlist = ["X", "x"] print(count_contains_x(strlist)) 2 list_of_one_x = ["x"] print(count_contains_x(list_of_one_x)) 1

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

In python, The function count_contains_x takes a list of strings (wordList) and returns the count of how many strings in the list contain at least one upper- or lower-case 'x'.

Hint: Use the accumulator pattern to accumulate the count.

Hint: You might want to use the string method count.

For example:

Test Result
strlist = ["xerox", "OXEN", "whiffleball", "XOXOX"] print(count_contains_x(strlist)) 3
fish = ["angel", "gold", "cat", "puffer", "damsel"] print(count_contains_x(fish)) 0
strlist = ["X", "x"] print(count_contains_x(strlist)) 2
list_of_one_x = ["x"] print(count_contains_x(list_of_one_x)) 1

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Map
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT