Make a bot with Python

 Make a Bot with Python



        What is Python?

                     Python is a high-level interpreted general-purpose programming language. Python is one of the world's easiest, useful, modern programming languages. It can be for web, app development. It is also used to create machines or Artificial Intelligence bots. So today we will create a bot made of Python.

    What things do you need?

Nothing, Just a network connection ( which I think you have, or else you can't read this article of mine). Pycharm( code editor to run Python) and Python ( needed for the code editor to run Python)

  How to Download Pycharm and Python on your PC?

First, visit this website - Download Pycharm for Windows
If you are on Mac - Download Pycharm for Mac
If you are on Linux - Download Pycharm for Linux
                   On this website click on the black download button to download the free community edition. Once you have downloaded Pycharm on your computer, run the .exe file.
Open Pycharm. Now the real, interesting part begins -

First, we have to create a variable. Then we have to create an input field. like this -

question = input("Ask me something")

 Now run the code in your terminal. In this input field, the user will type a question 
Now we have to add questions and their answers like this-

  if question == "Who are you?"
     print("I am your AI friend")
elif question == "What can you do?"
     print(" I can talk to you")
else:
   print("Invalid input")

Here we have used the if/else statement to put questions and their answers. In this code, we are trying to tell the computer that -

If the text in the input box is -Who are you?-then the output text should be -I am you AI friend- 
Else if the text is -What can you do?- then print -I can talk to you-
If the text in the input box is not one of those above questions then print -invalid input. 

You can add many elif statements to add more questions. Now, do you understand how easy to understand Python is? If yes then follow and share my website. Also, visit my youtube channel for video tutorials. 
In this below code I have shown you how to add as many questions and their answers. 

question = input("ask me something")
  if question == "Who are you?"
     print("I am your AI friend")
elif question == "What can you do?"
     print("I can talk to you")
elif question == "What are you? "
     print("I am an AI")

In the above code, I have written 2 elif sentences. Like that you can add as many questions as want and their answers to make your bot like Siri, Cortana, etc. I will try to post an article on "some amazing Python projects"  later. 
To visit my YouTube channel just type Soumavawebtech in the search bar of YouTube.
Subscribe to my channel to get these types of articles converted into video tutorials and make you understand them better. By the way, pls follow my blog if you like it and then comment on something. Follow my blogs daily. 


         



1 Comments

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post