
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Could you help with the code and explanation of how it works?
![Write a function in Python that takes two strings of DNA sequence (say string1 and string2) as input and returns a list of the position(s) where
string2 is present as a substring of string1. If there are no positions an empty list should be returned. When printing positions use 1 as the first
position, rather than the 0 used by Python. The output using the above string/substring should be [3, 7]. Print the output of your function to search
for the three words below.
# Insert your code for Question 1 below
seg %3D "CGTATАСТААААСGGACGTTACGATATTGTСТСАСТТСАТСТТАССАСССТСТАТСТТАТTGCTGATAGAACACTAACCCСТСAGCTTTATTTСТА"
def linear(seq, sub):
positions
[]
return( positions )
print( linear( seq, 'ATG'))
print( linear( seq, 'CAT'))
print( linear( seq, 'TAGG') )](https://content.bartleby.com/qna-images/question/2ae3c598-5ca0-4a09-8f44-c28883b8b5eb/29e6f87d-580f-41a2-8c9b-f0b652a1a2ed/m1trst8_thumbnail.png)
Transcribed Image Text:Write a function in Python that takes two strings of DNA sequence (say string1 and string2) as input and returns a list of the position(s) where
string2 is present as a substring of string1. If there are no positions an empty list should be returned. When printing positions use 1 as the first
position, rather than the 0 used by Python. The output using the above string/substring should be [3, 7]. Print the output of your function to search
for the three words below.
# Insert your code for Question 1 below
seg %3D "CGTATАСТААААСGGACGTTACGATATTGTСТСАСТТСАТСТТАССАСССТСТАТСТТАТTGCTGATAGAACACTAACCCСТСAGCTTTATTTСТА"
def linear(seq, sub):
positions
[]
return( positions )
print( linear( seq, 'ATG'))
print( linear( seq, 'CAT'))
print( linear( seq, 'TAGG') )
Expert Solution

arrow_forward
Explanation
1) Below is Program that take two string of DNA sequence and return the list of positions of string2 present in string1
- It defines a function linear take two string, returns the list of position of second string in first string
- It creates a list to store positions
- Runs a loop to iterate through each character in the seq
- Check if a sub string present in seq string
- Append the index of substring
- Increment index by 1 so it prints position from 1 instead of 0
- Check if a sub string present in seq string
- return position list
- It calls the function linear with seq and sub string and display list
2) Save program in python file and run
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Similar questions
- We use a wide range of design techniques to increase our comprehension of the code.arrow_forwardCan you help me with the pseudocode and not the actual code? I haven't yet reached there. Just the pseudocode, so I can understand better?arrow_forwardWe use a wide range of design techniques to increase our comprehension of the code.arrow_forward
- We use a wide range of design techniques to increase our comprehension of the code.arrow_forwardCompilers have trouble with designs like VLIW and superscalar. Which building is more difficult? Why?arrow_forwardIn this lesson, you'll learn how to make your code more testable and get an overview of the compiler.arrow_forward
- Why do "la label" instructions always need to be translated into 2 lines of pseudo code? What about "lw label" instructions? Explain the similarities and differences in how they are implemented in MARS.arrow_forwardFirst, we'll cover the basics of the compiler, and then we'll get into some testing best practices.arrow_forwardDo you think we'll get an overview of the compiler and a justification of why it's so important for testing?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY