Use recursive functions only
Python only**
printSequencesStartingWith - Given a prefix string consisting of RNA bases, plus a target length of RNA, this function must print out every possible sequence of RNA bases of the target length which starts with the given prefix, in alphabetical order. Note that this function is not fruitful, although it serves as a warm-up for the next function, which is. When figuring out all possible RNA sequences, we assume that at each position one of the bases 'A', 'C', 'G', or 'U' appears. note that if the prefix provided is equal to or longer than the target length, just that prefix is printed (even if it's longer that required).
Hints:
You only need to print in the base case, and the base case should involve comparing the length of the prefix with the target length. (Think carefully about what this comparison should be!)
In the recursive case, you should call printSequencesStartingWith recursively exactly four times, once for each RNA base.
Define printSequencesStartingWith with 2 parameters
Use def to define printSequencesStartingWith with 2 parameters
Call print
Within the definition of printSequencesStartingWith with 2 parameters, call print in at least one place.
Call printSequencesStartingWith
Within the definition of printSequencesStartingWith with 2 parameters, call printSequencesStartingWith in at least one place.
Example:
In [ ]: printSequencesStartingWith(' ',1)
Prints:
A
C
G
U