Make a Helpdesk Bot | Py2


Previously, we learnt that we can add print statements to print things on the terminal. Now we will start with making a proper bot.


Firstly, we will greet the user using the print function like explained in py1

print("Hi, welcome to anar helpdesk bot")


Then, we want to ask the name of the user/customer. We can do this with input function which allows us to take inputs from the user or in this case, our customer. We can use this in many ways and this will get significant later on as well.

To greet and take input from the user we can code something like this:

input("Hi, may I know your name?")

Now when you run this code you will see that the script doesn’t stop automatically since its waiting for an input. Now once you give an input, you will see that the script doesn’t really do anything.

To store/remember an input, we have to use something known as “variables” in our python programs. Variables is just a way to reuse data in programming, for example, we can do something like a = 1 and then print the variable named a anywhere in our code; which would look something like this: print(a)

Note you don’t need to add quotation when using print function with variables. This is because its not a string and the data is dynamic, if you put quotes then it would just print “a” everytime.


For out bot we can comment out our input function by adding “#” infront of the line where which would make our script ignore the line thus not running it when the code.

# input("Hi, how may I help you today?")

Now you can run the code however nothing will happen.


To add a variable to your input statement, we can just do this:

issue = input("How may I help you today?)

Here issue can be called whatever you like. Now you can call it whenever you want in the script, to test this we can just add a print function to print the variable issue


and this should print whatever is input is given to the input function.

Final code

print("Hi, welcome to anar helpdesk bot")
# input("Hi, may I know your name?")
issue = input("How may I help you today?\n")

All code used in this course will be availble at:

that’s it <3