Def locate_substring(dna_snippet, dna): This function takes in two strings, dna_snippet and dna, where dna_snippet is a substring of dna, and returns all locations of the substring as a list of integers. In other words, dna_snippet may exist in multiple locations within dna; you should return the beginning index position of each occurrence of dna_snippet inside of dna. Example: * Sample DNA snippet (substring): "ATAT" * Sample DNA string: "GATATATGCATATACTT" * The returned position list: [1, 3, 9]

Answers

Answer 1

Answer:

In Python. The function is as follows:

def locate_substring(dna_snippet, dna):

   res = [i for i in range(len(dna_snippet)) if dna_snippet.startswith(dna, i)]  

   print("The returned position list : " + str(res))

Explanation:

This iterates defines the function

def locate_substring(dna_snippet, dna):

Check for all occurrence

   res = [i for i in range(len(dna_snippet)) if dna_snippet.startswith(dna, i)]  

print all occrrence

   print("The returned all position list : " + str(res))

Answer 2

Following is the Python program to the given question.

Python

According to the question,

DNA Series: GATATATGCATATACTTDNA

Snippet: ATAT

Program: def locate_substring (dna_snippet, dna):

start = 0 while True: start = dna.

find(dna_snippet, start) #finding the first occurrence of dna_snippet in dna.

if start == -1: return # if dna.find() returns -1 yield start #Resumes next execution start += 1dna=input ("Enter the DNA sequence: ") dna_snippet=input

("Enter the DNA snippet: ") print(list(locate_substring(dna_snippet,dna )))

Program Explanation: Defining a function.

An infinite loop is being utilized just to produce the indexes from which dna snippet begins.

Determining the initial occurrence of dna snippet inside dna. storing the new occurrences of dna snippet throughout the starting point.

Whenever dna.find() returns minus one, it means there was no occurrence identified and the method should be exited.

Find out more information about Python here:

https://brainly.com/question/26497128


Related Questions

Why would an organization need to be aware of the responsibilities of hosting

personal data in its platforms?

Answers

Answer:

Providing transparent services for platform customers. Following data protection regulations to avoid disruptions from lack of compliance.

how to learn python ?

Answers

Answer:

See below.

Explanation:

To learn python programming language, first, you have to know the basic. Surely, you may recognize this function namely print()

print(“Hello, World!”) — output as Hello, World!

First, start with familiarizing yourself with basic function such as print. Then step up with arithmetic and declare or assign variable then list.

Here are example of functions:

1.) print(argument) — If argument is a string (word-typed), make sure to use “” or ‘’ or else it’ll output an error and say the argument is not defined.

print(“Hi, Brainly”) will output Hi, Brainly

print(2+3) will output 5

Numerical data or numbers do not necessarily require “ “ or ‘ ‘

print(3+3) will output 6 but print(“3+3”) will output 3+3 which is now a string.

2.) type(argument) - this tells you which data/argument it is. There are

< class ‘str’ > which is string, meaning it contains “ “ or ‘ ‘< class ‘int’ > which is integer< class ‘float’ > which is decimal (20.0 is also considered as float, basically anything that contains decimal is all float type)< class ‘list’ > which is a list. List is something that contains elements within square brackets [ ]

etc.

Make sure you also do print(type(argument)) as well so it will print out the output.

3.) Arithmetic

+ is addition

Ex. print(1+3) will output 4

   2. - is subtraction

Ex. print(5-4) will output 1

   3. * is multiply

Ex. print(4*5) will output 20

   4. ** is exponent

Ex. print(5**2) will output 25

   5. / is division

Ex. print(6/3) will output 2 — sometimes will output the float type 2.0

   6. % is modulo or remainder

Ex. print(7%2) will output 1

4.) Variables

To assign a variable, use =

An example is:

x = 2

y = 5

print(x+y) will output 7

print(type(x)) will output the < class ‘int’ >

These are examples of what you’ll learn in basic of python - remember, programming depends on experience and always focus on it. Keep practicing and searching will improve your skill at python.

Assume in the for loop header, the range function has the three arguments: range (1, 10, 3), if you were to print out the value of the variable
in the for loop header, what will be printed out? List the values and separate them with a comma.

Answers

Answer:

1, 4, 7

Explanation:

The instruction in the question can be represented as:

for i in range(1,10,3):

   print i

What the above code does is that:

It starts printing the value of i from 1

Increment by 3

Then stop printing at 9 (i.e.. 10 - 1)

So: The sequence is as follows

Print 1

Add 3, to give 4

Print 4

Add 3, to give 7

Print 7

Add 3, to give 10 (10 > 10 - 1).

So, it stops execution.

Computers were originally invented to
Group of answer choices
A.to share information on the Internet.

B.make complex mathematical calculations possible and make tasks easier for humans.

C.to play video games.

Answers

Answer:

B

Explanation:

It's B because why would it me made to play video games

Answer:

B

Explanation:

A, the internet didnt exist yet, so it cant be this

C, video games would require computers, so its ruled out on a similar basis as the previous

For this exercise, you are going to complete the printScope() method in the Scope class. Then you will create a Scope object in the ScopeTester and call the printScope.
The method will print the name of each variable in the Scope class, as well as its corresponding value. There are 5 total variables in the Scope class, some of which can be accessed directly as instance variable, others of which need to be accessed via their getter methods.
For any variable that can be accessed directly, use the variable name. Otherwise, use the getter method.
Sample Output:
The output of the printScope method should look like this:
a = 5
b = 10
c = 15
d = 20
e = 25
public class ScopeTester
{
public static void main(String[] args)
{
// Start here!
}
}
public class Scope
{
private int a;
private int b;
private int c;
public Scope(){
a = 5;
b = 10;
c = 15;
}
public void printScope(){
//Start here
}
public int getA() {
return a;
}
public int getB() {
return b;
}
public int getC() {
return c;
}
public int getD(){
int d = a + c;
return d;
}
public int getE() {
int e = b + c;
return e;
}
}

Answers

Answer:

Explanation:

The following is the entire running Java code for the requested program with the requested changes. This code runs perfectly without errors and outputs the exact Sample Output that is in the question...

public class ScopeTester

{

public static void main(String[] args)

{

       Scope scope = new Scope();

       scope.printScope();

}

}

public class Scope

{

private int a;

private int b;

private int c;

public Scope(){

a = 5;

b = 10;

c = 15;

}

public void printScope(){

       System.out.println("a = " + a);

       System.out.println("b = " + b);

       System.out.println("c = " + c);

       System.out.println("d = " + getD());

       System.out.println("e = " + getE());

}

public int getA() {

return a;

}

public int getB() {

return b;

}

public int getC() {

return c;

}

public int getD(){

int d = a + c;

return d;

}

public int getE() {

int e = b + c;

return e;

}

}

User ideas for ro blox? I prefer no numbers or underscores.

Answers

do what the other person said

Other Questions
When John Lewis was offered the opportunity to sue the state of Alabama in order to be admitted to Troy College, his parents refused. Why didn't they support John's efforts to attend the school? What was their viewpoint as it relates to Blacks living in the rural south? Explain in 3-5 sentences. * I need help on this and the person who answer this correctly gets a BRANLIST(answer if you know) what is (x+2)^4 using binomial theorem and pascals triangle? What is the solution to this system of equations?2x+y=6- 2 x - y = 2(1,-1)(0,8)infinitely many solutionsO no solution Which statement expresses the idea of laissez faire?O A nation's true wealth is in silver and goldO The best government for small countries is a republic.O The government should not regulate any part of the economyCommerce and trade are more important than agriculture 11) Why were southern states willing to secede from the Union? No pic if you could just type the answer.A group of three girls (Hannah, Jenny, and Kiesha) and two boys (Isiah and Luke)met up at the big annual Playland Park Easter Egg Hunt. The childrens last names(in no particular order) are Dwyer, Anders, Fields, Yu, and Wise.When the hunt began, each child found a different colored egg (blue, green, yellow, pink, and orange) in a different location (in a bush, behind a rock, on the slide, in the grass, and under a bench). Each childs egg contained a different type of Easter treat (marshmallow chick, gumball, jelly beans, chocolate egg, and candy corn).Use the 10 clues below to match each childs first and last names, with the location where they found their egg, the color of their egg, and the treat inside their egg.1. Hannah did not find her egg on the slide or in the grass. Her egg did not contain a gumball or candy corn.2. The boy with the last name of Fields did not find the blue egg.3. The girl who found her egg in a bush did not have a gumball or a marshmallow chick in her egg.4. The yellow egg had a chocolate egg inside of it. It was found by the child with the last name of Wise.5. One of the girls found the pink egg on the slide.6. Lukes green egg was not hidden in the grass or under a bench.7. Kiesha Yu got jelly beans in her egg.8. The girl with the last name of Anders found the orange egg.9. The blue egg was hidden in a bush.10. The egg that was filled with candy corn was hidden behind a rock. type a question about gas starting with what if You make $52,000 a year. Your state income tax rate is 2.5%. The state income tax allowance is $1500 per person and you have three allowances. They are yourself, your spouse and one child. How much income tax do you owe? Work out the reciprocal of 0.125 Of the males surveyed, what proportion selected small T-Shirt size pls help i need answer Can someone plzzzz help meeee!!!!! Find the smallest value of m such that the LCM of m and 34 is 374. which answer is correct What is the slope of the line that contains the points (-2, 7) and (2, 3)?A. 4OB. 1oC. -1D. -4SUBMIT If y varies directly as x, if y = 8 when x = 4, find y when x = 48 For each ordered pair determine whether its a solution to 5x plus 2y = -1 How many grams of Ag2Sare produced from 10.0grams of AgI?10AgI + NazsAg2S +NaI Consider the effects of inflation in an economy composed of only two people: Larry, a bean farmer, and Megan, a rice farmer. Larry and Megan both always consume equal amounts of rice and beans. In 2016 the price of beans was $1, and the price of rice was $4.Suppose that in 2017 the price of beans was $2 and the price of rice was $8.Inflation was.Indicate whether Larry and Megan were better off, worse off, or unaffected by the changes in prices.Better OffWorse OffUnaffectedLarry Megan Now suppose that in 2017 the price of beans was $2 and the price of rice was $4.80.In this case, inflation was.Indicate whether Larry and Megan were better off, worse off, or unaffected by the changes in prices.Better OffWorse OffUnaffectedLarry Megan Now suppose that in 2017, the price of beans was $2 and the price of rice was $1.60.In this case, inflation was.Indicate whether Larry and Megan were better off, worse off, or unaffected by the changes in prices.Better OffWorse OffUnaffectedLarry Megan What matters more to Larry and Megan?The relative price of rice and beansThe overall inflation rate