3. Use recursive functions only Python only** listSequencesStartingWith - Given the same arguments as printSequencesStar

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

3. Use recursive functions only Python only** listSequencesStartingWith - Given the same arguments as printSequencesStar

Post by answerhappygod »

3. Use recursive functions only
Python only**
listSequencesStartingWith - Given the same arguments as printSequencesStartingWith, this function must return a list of strings containing all of the RNA sequences that that function would have printed. If the prefix provided is equal to or longer than the target length, a list containing just that prefix string is returned. These listSequencesStartingWith examples demonstrate how it should work.
Hints:
• In the base case, think first about type of value you need to return before figuring out the actual value.
• In the recursive case, you should call listSequencesStartingWith recursively exactly four times, once for each RNA base.
• Using append in this function is not recommended. Using the + operator to combine lists is likely a better approach.
Define listSequencesStartingWith with 2 parameters
Use def to define listSequencesStartingWith with 2 parameters
Use a return statement
Within the definition of listSequencesStartingWith with 2 parameters, use return _ in at least one place.
Call listSequencesStartingWith
Within the definition of listSequencesStartingWith with 2 parameters, call listSequencesStartingWith in at least one place.
In [ ]: listSequencesStartingWith(' ',1)
Out[ ]: ['A', 'C', 'G', 'U']
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply