Question
Python If/else statements help I am trying to make a simple input/output python chat bot using python 1, Change any sentence that has the words
Python If/else statements help
I am trying to make a simple input/output python chat bot using python
1, Change any sentence that has the words " I will" to "They are" Example: "I will go eat" to "They are go eat" (Ignore obvious grammatical errors, that is fine)
Randomize between "I will go eat" and "Are you really ..." and " Did you escape since .."
This means that any message starting with "I will" would be changed to "They are" or "Are you really ...+UserInput" or " Did you escape since .+UserInput."
Example: Input: "I will go eat"
Random Response output 1 : "They are go eat"
Random Response output 2: Are you really I will go eat?
Random Response output 3: Did you escape since I will go eat
So any time a user enters a message starting with "I will" it will pick one random response from those three above.
2, Take random user inputs and combine it with this sentence " Elaborate why do you think.." One way to do this is like step #4 below where you store the user inputs in a list and then combine it with the sentence "Elaborate why do you think.." then print it to the screen randomly 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 the word "cat" and then use everything after the word "cat)
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. Basically everything the user types will be stored in a list somehow then it will be combined with this phrase " "proceed..." and then that is printed on the screen randomly or after every 10 sentences both scenarios work . Example
User Input: i will be a doctor"
Response/Output: proceed...I will be a doctor
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, input: Give me a "x" or I want to take x"
In this example "x" is the user input
response for these: Why do you want "x" or I wont give you "x" Again these responses are randomized
So if i type "Give me a dog" or "I want to take a dog"
The responses are "Why do you want dog" or "I wont give you dog" These responses are randomized and only one is picked.
Whatever the user inputs takes the place of "x"
7, Input: "X is almost like Y"
"X" and "Y" are user inputs
If i type "Dog is almost like cat"
"dog" is the "x" and "cat" is the "Y" But the response below only needs to fetch "X" input
The response output is: "What is the difference of "x" which becomes "What is the difference of dog (since x is the first word and the word in this example is "dog")
Thank you for your help!
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