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
How to install python?
For python installation process see the below video.
Basic Python Bot.
Open the notepad and copy , paste the code given below.
name = input(“Hello, what is your name? “)
print(“Hello ” + name)
feeling = input(“How are you today? “)
if “good” in feeling:
Â Â Â print(“I’m feeling good too!”)
Â Â Â print(“I’m sorry to hear that!”)
favcolour = input(“What is your favourite colour? “)
colours = [“Red”,”Green”,”Blue”,”Yellow”]
print(“My favourite colour is Â ” + random.choice(colours))
Save the file as your project name with .py extension.
Open the command prompt and choose the your project file path.
Â Â Â 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
C:\Users\windows user\cd ..
E:\cd your project folder name and press Enter
E:\your project folder\your file name .pyÂ Â and press Enter
Check the output.