Question: All of your code for this problem should go in a file called Recursionwarmup.py. Write each of the following functions using recursion. (Do not use

 All of your code for this problem should go in a
file called Recursionwarmup.py. Write each of the following functions using recursion. (Do

All of your code for this problem should go in a file called Recursionwarmup.py. Write each of the following functions using recursion. (Do not use for loops or while loops for these problems.) 1. power(x, y) takes two non-negative integers x and y as input and returns the value x. Of course, we could do this simply using the notation x"y, but the point here is to do this using recursion and multiplication. Note that x is 1 by definition. >>> power(2, 3) >>power(10, 2) 100 2. dot(L, K) should output the dot product of the lists L and k. The dot product of two lists is the sum of the products of the elements in the same position in the two lists. You may assume that the two lists are of equal length. If these two lists are both empty, dot should output e.e. Assume that the input lists contain only numeric values. >>> dot ([s,3], [6,4]) Note that 5*63*4 42 42 3. Gccount (DNA) takes DNA string as input and returns the number of G's and C's that appear in that string >>> GCcount ( 'TGTCG) GCcount ('ATATAT') 4. countstarts (DNA) takes a DNA string as input and returns the number of times the string ATG' appears in that string. We did this problem in Chapter 3 using for loops. The objective here is to do it using recursion >>> countstarts( 'ATGCATGT 5. explode(S) takes a string s as input and should return a list of the characters (each of which is a string of length 1) in that string. For example: >explode('spam) >> explode () Il Note that Python is happy to use either single quotes or double quotes to delimit strings -they are interchangeable but if you use a single quote at the start of the string you must use one at the end of the string (and similarly for double quotes). For example: -spam" >>> .spam. True

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!