0% found this document useful (0 votes)
301 views2 pages

Simple Python Chatbot Program

This Python program implements a simple chatbot that can answer questions about its name, how it is, what it does for work, and what it did the previous day. The chatbot prints a list of questions it can answer and then continuously takes user input in a loop, checking the input against known questions and printing the corresponding response, or indicating it doesn't understand the question.

Uploaded by

Suryateja Koka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
301 views2 pages

Simple Python Chatbot Program

This Python program implements a simple chatbot that can answer questions about its name, how it is, what it does for work, and what it did the previous day. The chatbot prints a list of questions it can answer and then continuously takes user input in a loop, checking the input against known questions and printing the corresponding response, or indicating it doesn't understand the question.

Uploaded by

Suryateja Koka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1. Write a python program to implement simple Chatbot?

Code:
print("Simple Question and Answering Program")
print("=====================================")
print(" You may ask any one of these questions")
print("Hi")
print("How are you?")
print("Are you working?")
print("What is your name?")
print("what did you do yesterday?")
print("Quit")
while True:
question = input("Enter one question from above list:")
question = question.lower()
if question in ['hi']:
print("Hello")
elif question in ['how are you?','how do you do?']:
print("I am fine")
elif question in ['are you working?','are you doing any job?']:
print("yes. I'am working in KLU")
elif question in ['what is your name?']:
print("My name is Emilia")
name=input("Enter your name?")
print("Nice name and Nice meeting you",name)
elif question in ['what did you do yesterday?']:
print("I did 3D printing ")

elif question in ['quit']:


break
else:
print("I don't understand what you said")
Output:
Simple Question and Answering Program
==============================
You may ask any one of these questions
Hi
How are you?
Are you working?
What is your name?
what did you do yesterday?
Quit
Enter one question from above list:hi
Hello
Enter one question from above list:how are you?
I am fine
Enter one question from above list:are you working?
yes. I'am working in KLU
Enter one question from above list:what is your name?
My name is Emilia
Enter your name?sachin
Nice name and Nice meeting you sachin
Enter one question from above list:quit

You might also like