Question
Python question. 1. Write the recursive function containing_word , which takes as its argument a nested list of sentence strings and a target word, returning
Python question.
1. Write the recursive function containing_word, which takes as its argument a nested list of sentence
strings and a target word, returning a list of sentences that contain the target word.
For example,
sentence_list = ['Hi mc', ['A',['mc'],'c']]
The call containing_word(sentence_list, mc) should return ['Hi mc', 'mc']
def containing_word(slist: [str or list], target: str ) -> [str]:
???
2. Write a recursive function recursive_list_division which takes in a nested list of integers and returns a nested list of integers whose values are all divided by the parameter n.
def recursive_list_division(n: int, nums : list) -> list
???
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started