Answer the question
In order to leave comments, you need to log in
How can the result of defining one function be passed to a parameter when defining another function?
For example, there is a function definition def get_words(text: str) -> list,
which
results in a list of a list of tuples:
(
<word from text in lower case - str>,
<word start position - int>,
) you need to write a function def get_index_of_words(words: list) -> dict , which for each word forms a list of positions from which this word begins in the text. How to assign the result of the get_words(text) function to the words parameter? Please note that the function definition instruction `def get_index_of_words(words: list) -> dict:` is not allowed to be changed!
An example of the result of the get_index_of_words(words) function:
Answer the question
In order to leave comments, you need to log in
Firstly, you don’t need to sculpt screenshots here, it’s better to insert text and frame with tags.
Secondly,
text = “the text”
get_index_of_words(get_words(text))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question