Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:30, nsjcbdhcb
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
image
Computers and Technology, 23.06.2019 12:20, jshhs
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
image
Computers and Technology, 24.06.2019 00:00, Kaylaonfleek0956
Consider the series where in this problem you must attempt to use the ratio test to decide whether the series converges. compute enter the numerical value of the limit l if it converges, inf if it diverges to infinity, minf if it diverges to negative infinity, or div if it diverges but not to infinity or negative infinity.
Answers: 1
image
Computers and Technology, 24.06.2019 15:30, lakenyagillard79
Python. primary u. s. interstate highways are numbered 1-99. odd numbers (like the 5 or 95) go north/south, and evens (like the 10 or 90) go east/west. auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two digits. thus, the 405 services the 5, and the 290 services the 90. given a highway number, indicate whether it is a primary or auxiliary highway. if auxiliary, indicate what primary highway it serves. also indicate if the (primary) highway runs north/south or east/west.
Answers: 1
Do you know the correct answer?
Write a recursive function named is_subsequence that takes two string parameters and returns True if...

Questions in other subjects:

Konu
Chemistry, 09.04.2020 05:04
Konu
Mathematics, 09.04.2020 05:04
Konu
Mathematics, 09.04.2020 05:04