Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

Explain the seven dimensions of an organizations climate.

Answered: 1 week ago