+ 3
How to create a chatbot (sort of) in python using this.
We can split the string and then put conditions like If "string" contains "how"&"are"&"you": print("I m fine!") Like this we have to do a lot of questions. But anyways is there any function to do this??? If you know please answer If you don't know please give this question an upvote.
3 Answers
+ 6
yes, you use "in" with an if statement
example:
if "hello" in variableName:
print("Something")
+ 3
message = 'How are you?'
if all([word in message.lower() for word in ('how', 'are', 'you')]):
print('I\'m fine')