You are on page 1of 5

Chatbot:

Output:
Code:
valid = True
print("alexa is here:)")
while valid:
print("Type...")
state=input()
if state !="Bye":
valid=True
if state=="Hye":
print("hello!")
elif state=="how are you?":
print("I'm fine.")
elif state=="What is your hobby?":
print("My hobby is to help you.")
elif state=="What you did for me?":
print("i'm searching for you or provide some meterial regarding
your instruction etc.")
elif state=="We became Friends?":
print("Well, its honerable for me to became your friend")
elif state=="what is your name?":
print("Alexa")
elif state=="What Alexa means?":
print("mean defender of man.")
elif state=="ok! see you":
print("okay ! have a nice day")
elif state=="I want to perform some Arithmatic operations":
print("Enter 2 integer values")
print("Enter 1st number")
a=int(input())
print("Enter 1st number")
b = int(input())
print("Which operation want to perform: + ,- ,* , /, %")
c=input()
if c=="+":
print("The Sum of", a, "and ", b, "is", a + b)
elif c=="-":
print("The Subtraction of", a, "and ", b, "is", a - b)
elif c=="*":
print("The Multiplication of", a, "and ", b, "is", a * b)
elif c=="/":
print("The Division of", a, "and ", b, "is", a / b)
elif c=="%":
print("The Modulus of", a, "and ", b, "is", a % b)
else:
print("I can't perform!")
else:
print("Sorry! I can't understand you")
continue
else:
valid=False
print("Bye! Nice to meet you.")
break

You might also like