Question: python Use the function design recipe to develop a function named has_pair. The function header (with missing type annotations) is: has_pair (s,ch). Parameter s is

python
python Use the function design recipe to develop
Use the function design recipe to develop a function named has_pair. The function header (with missing type annotations) is: has_pair (s,ch). Parameter s is a string that has at least two characters. Parameter ch is a string containing exactly one character. The function returns True if s contains two occurrences of ch next to each other; otherwise it returns False. For example, when has_pair is called this way: has_pair('abccd', ' c '), the function returns True, because 'abccd' contains a ' c ' next to a ' c '. When has_pair is called this way: has_pair('abcdc', ' 'c'), the function returns False. Although ' abcdc' contains two occurrences of ' c ', the first one isn't beside the second one. Your function must have exactly one loop. Your function definition must have type annotations and a complete docstring. Use the Python shell to test has_pair

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!