Python Bot Tutorial

Why we go for python to create a bot?

Python is an interpreted, high-level, general-purpose programming language,  and it’s one of the fastest growing language. Everyone talking about python is  a new language but in real python is older than java, C#, etc. Now a days most of the developer prefer python for MACHINE LEARNING, ARTIFICIAL INTELLIGENCE because the easiest language available in market it’s called Python. it’s much easier than c, c++, java. Even  google, Dropbox, youtube, yahoo, NASA also using python as a main language or supporting language.

 

What are the tool’s need to create a python bot?

  • Python (latest version preferable)
  • Command prompt
  • Notepad

 

How to install python?

For python installation process see the below video.

 

Basic Python Bot.

Step:1 

Open the notepad and copy , paste the code given below.

 

import time

import random

name = input(“Hello, what is your name? “)

time.sleep(2)

print(“Hello ” + name)

feeling = input(“How are you today? “)

time.sleep(2)

if “good” in feeling:

   print(“I’m feeling good too!”)

else:

   print(“I’m sorry to hear that!”)

time.sleep(2)

favcolour = input(“What is your favourite colour? “)

colours = [“Red”,”Green”,”Blue”,”Yellow”]

time.sleep(2)

print(“My favourite colour is  ” + random.choice(colours))

 

Step 2: 

Save the file as your project name with .py extension.

Step 3:

Open the command prompt and choose the your project file path.

example:

      1. If your file in desktop.

C:\Users\windows user\cd desktop and press Enter

C:\Users\windows user\desktop\your file name .py  and press Enter

     2. Else your file in other drive follow below

example:

C:\Users\windows user\cd ..

C:\Users\cd ..

C:\>E:

E:\cd your project folder name and press Enter

E:\your project folder\your file name .py  and press Enter

Step 4:

Check the output.

 

error: