Question
PYTHON PROGRAMMING In this question you are not allowed to use any of the Pythons string methods (i.e. those string functions that you call with
PYTHON PROGRAMMING
In this question you are not allowed to use any of the Pythons string methods (i.e. those string functions that you call with dot operator). Say a character is extraordinary if it is one of the following: the lower case letter between e and j (inclusive), the upper case letters between F and X (inclusive), numerals between 2 and 6 (inclusive), and the exclamation point (!), comma (,), and backslash (\) You are required to count how many times these characters appear in a string. Write a function called countMembers that takes a single input parameter s, of type str. countMembers then returns the number of characters in s, that are extraordinary. Therefore, if there are two Xs in s, countMembers must count two extraordinary characters (one for each occurrence of X in s).
>>>> TESTING CODE:
>>> countMembers("\\")
1
>>> countMembers("2\")
1
>>> countMembers("1\")
0
>>> countMembers("2aAb3?eE_13")
4
>>> countMembers("one, Two")
3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started