Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago