+ 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.

29th May 2019, 1:17 PM
King Infinity
King Infinity - avatar
3 Answers
+ 6
yes, you use "in" with an if statement example: if "hello" in variableName: print("Something")
29th May 2019, 1:24 PM
haydenki
haydenki - avatar
+ 3
message = 'How are you?' if all([word in message.lower() for word in ('how', 'are', 'you')]): print('I\'m fine')
29th May 2019, 1:41 PM
Š˜Š³Š¾Ń€ŃŒ ŠÆŠŗŠ¾Š²ŠµŠ½ŠŗŠ¾
Š˜Š³Š¾Ń€ŃŒ ŠÆŠŗŠ¾Š²ŠµŠ½ŠŗŠ¾ - avatar