Answered step by step
Verified Expert Solution
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 commonpair, 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 mutil
def commonpairleft: str right: str str:
pass # Delete this and replace with your answer here
commonpairtests
# case, left, right, common pair
one is empty', 'ACTG',
same string', 'ACTG', 'ACTG', AC
nothing common', 'ACCA', GTGT
subsequence 'AAAA', 'GATTA',
testcommonpair, commonpairtests
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