Check out the chat bot program on code.org in Python. It's very basic but truly amazing how simple the concept is. I have developed a sample code that shows how to program a chat bot. (Note that unlike in most programming languages GOTO statement has to be configured.)
def goto(linenum):
global line
line = linenum
while True:
line = 1
print("What movie do you want to watch?")
name = input()
if (name == "Wall-E"):
print("That was fun")
break
elif (name == "Transformers"):
print("Choose another one...")
goto(1)
else:
goto(1)
def goto(linenum):
global line
line = linenum
while True:
line = 1
print("What movie do you want to watch?")
name = input()
if (name == "Wall-E"):
print("That was fun")
break
elif (name == "Transformers"):
print("Choose another one...")
goto(1)
else:
goto(1)
Comments