Question: Write and test a Python function common _ pair, that checks whether any two consecutive characters of left match any two consecutive characters in right.

Write and test a Python function common_pair, that checks whether any two consecutive characters of left match any two consecutive characters in right. The function should return the first two matching characters it finds or the empty string if there is no match.
Complete the function in the following cell. We have provided some tests; your tutor may use additional tests.
%run -i m269_util
def common_pair(left: str, right: str)-> str:
pass # Delete this and replace with your answer here
common_pair_tests =[
# case, left, right, common pair
('one is empty', 'ACTG', '',''),
('same string', 'ACTG', 'ACTG', 'AC'),
('nothing common', 'ACCA', 'GTGT',''),
('subsequence', 'AAAA', 'GATTA', '')
]
test(common_pair, common_pair_tests)

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 Databases Questions!