Question: Python Help with if statements/string arrays and RNG(a simple question and response script, similar to a chat bot) Using Python to create a question/response script

Python Help with if statements/string arrays and RNG(a simple question and response script, similar to a chat bot)

Using Python to create a question/response script using List + import Random

Other methods are allowed too

1, if the user enters a message that starts with "i will" The response will change "I will" to "They are" There are also 3 other random statements that are thrown in there and the script will pick one at random. 1, "Are you really ...." or 2," Did you escape since .." 3, changes "i will" to "They are". At random "I will" be either be changed to "They are " Or the script will take the user statement and put it as a question. This is only for sentences that start with "I will". Basically either change to "They are" or combine 1,2 above with the user original input without changing it from "I will" this is picked at random.

Note: I will is case sensitive

Example:

User Input: I will be a doctor"

Potential response/Output: " They are be a doctor" or " are you really... I will be a doctor?" or " Did you escape since..... I will be a doctor"

Ignore any obvious grammatical errors, that is ok

2, Take random user inputs and combine it with this sentence " Elaborate why do you think.." Example:

User Input: I love the sun

Response/output: Elaborate why do you think I love the sun"

3, Use the sentence after this specific word "cat" then combine the words after "cat" to "Why do you think you are.." Basically everytime the user enters a sentence with the word "cat", you take everything after the word "cat" and combine it with ""Why do you think you are.." Example

User inputs : "our cat is pretty cute"

Response/output: " Why do you think you are is pretty cute"

Ignore obvious grammatical issues, that is fine.

4, Store the user inputs in a list then randomly combine it with this sentence "proceed..." and then print it every 10 sentences or so. Example

User Input: i will be a doctor"

Response/Output: proceed...they i be a doctor

Note: Notice how this is "i will" is not "They are" because 'i' is not capital. Its case sensitive.

Note: if the word triggers overlap thats ok, just make sure they are randomly picked if they overlap.

for example: "I will let you pet my cat" this sentence has multiple word triggers like 'I will" and "cat" just combine both responses from both word triggers and pick one at random.

5, if the input string is less than < 20 characters make the output response " I want more information"

6, Give me __ or I want to take __

response for these: Why do you want __ or I wont give you __

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!