subject

Write a recursive function named is_subsequence that takes two string parameters and returns True if the first string is a subsequence of the second string, but returns False otherwise. We say that string A is a subsequence of string B if you can derive A by deleting zero or more letters from B without changing the order of the remaining letters. You can assume that neither string contains upper-case letters. You may use default arguments and/or helper functions.
Your recursive function must not: use imports. use any loops use any variables declared outside of the function. use any mutable default arguments.
What I have so far (must use this format):
def is_subsequence(strA, strB = None):
if strB == None:
strB = []
print(is_subsequence("dog", "dodger"))
My problem:
I can't figure out how to recursively edit the string the way the assignment says by removing letters. (strB. replace("e","") doesn't work) or how to do this without passing an index.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:40
What are the three parts to physical security standards for various types of army equipment and the risk level
Answers: 2
question
Computers and Technology, 22.06.2019 15:30
In a compound condition, both conditions on either side of the logical operator and must be true for the overall condition to be true. a: true b: false
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Which of the following is not a source of sustainable raw materials? a) coal mine b) flick of sheep c) cotton plantation d) line forest.
Answers: 2
You know the right answer?
Write a recursive function named is_subsequence that takes two string parameters and returns True if...
Questions
Questions on the website: 13722367