Made with
Checkout this project at trinket.io
The chatbot asks a few questions e.g. what is your name, where do you live etc. etc. Then, the chatbot asks you a riddle, and, based on your answer, replies. This is done using user inputs and if statements. I hope you like it!💻
- By Adrij Ray
The Code:
print("Hi there")
print('What is your name?')
name=input()
print("hello "+name+"!")
print('How are you '+name+'?')
print('I know that i am feeling talkative today. And I am feeling great')
print('Where do you live?')
place=input()
print('Nice! I live in '+place+' too!')
print('How old are you?')
age=input()
print('Nice! I am '+age+' too!')
print('What is your favourite animal?')
animal=input('type your answer with no capital letters, spaces or determiners. Also, do not write your answer in plurals.')
if animal=="cat":
print("Cool! I like cats as well!")
else:
print('WHAT! Are you CRAZY! You do not like CATS!')
print('I am going to tell you a riddle.')
print('What sounds like a parrot, Wears a green hat and is orange')
riddle=input('type your answer with no capital letters, spaces or determiners. Also, do not write your answer in plurals. ')
if riddle == 'carrot':
print('How did you get it correct?')
print('Oh well. I stand defeated.')
else:
print('HAHAHA. You did not get it right! I am so happy right now!')
print('Anyways, the answer was...drumroll please')
print('carrot!')
print('Anyways, it was nice meeting you '+name+'! But for now, I am afraid we will have to say goodbye')