Question: use python Next we will write a function that will help us select an output for the chatbot, based on the input it got. The

use python
use python Next we will write a function that will help us

Next we will write a function that will help us select an output for the chatbot, based on the input it got. The overall goal of this function is to take a list of words that we got as input, a list of words to check for whether they appear in the input, and a list of possible outputs to return it something from the list to check is in the input list Define a function called selector This function should have the following inputs, outputs, and internal procedures: Inputs): input_list - list of strings .check_list list of strings return_list - list of strings . Outputs): output - string, or None Procedures Initialize output to None Loop through each element in input_list Use a conditional to check if the current element is in check_list . It is assign output as the returned value of calling the randon.choice function on return_list Also, break out of the loop . At the end of the function, return output Note that if we don't find any words from input list that are in check list. output will be returned as None

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the selector function according to the given specifications you can use Pythons randomc... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!