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

Practical-1: 2IT702: Artificial Intelligence Practical-1

This document provides code for a basic chatbot program in Python. The code prints out a list of questions that can be asked and takes user input. Based on the input, it provides pre-defined responses - it will greet the user, say it is fine in response to "how are you", provide its name as Devanshi, birthdate as 26-06-2000, and favorite food as pizza. It also has an option to exit the program.
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)
79 views2 pages

Practical-1: 2IT702: Artificial Intelligence Practical-1

This document provides code for a basic chatbot program in Python. The code prints out a list of questions that can be asked and takes user input. Based on the input, it provides pre-defined responses - it will greet the user, say it is fine in response to "how are you", provide its name as Devanshi, birthdate as 26-06-2000, and favorite food as pizza. It also has an option to exit the program.
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

2IT702: Artificial Intelligence Practical-1

Practical-1

Aim : Write a python/Java program to implement simple Chatbot.

Code:
print(" chatbot ")
print("=================================================")
print("You can ask one of the questions from following list.")
print("1] Hii")
print("2] How are you?")
print("3] What is your name?")
print("4] What is your birthdate?")
print("5] What is you favourite food?")
print("6] exit")
while True:
ques=input("Write your question :")
ques=ques.lower()
if ques in [1,"hii","hi","hello"]:
print("Hello")
elif ques in [2,"how are you?"]:
print("I am fine")
elif ques in [3,"what is your name?","your name?"]:
print("My name is Devanshi")
elif ques in [4,"what is your birthdate?","your birthdate?"]:
print("My birthdate is 26-06-2000")
elif ques in [5,"what is your favourite food?","favourite food?","your favourite food?"]:
print("My favourite food is Pizza.")
elif ques in [6,"quit","exit"]:
break
else:
print("Please enter one of the question from above list")

Name:Devanshi Parejiya Page 1


Enrollment No.: 17012021005
2IT702: Artificial Intelligence Practical-1

OUTPUT:-

Name:Devanshi Parejiya Page 2


Enrollment No.: 17012021005

You might also like