I'm creating a chatbot that should simply respond back to the user when the user asks it a specific question the bot will detect it the code and respond back with the correct output. But I need help resolving a TypeError.
My code:
user_name = input('''What would you like to be called:
''')
bot_name = input('''
Now lets give you virtual bot a name:
''')
print(' ')
print(f"{'Thank you'} {user_name} {'You have just summoned a new bot named'} {bot_name}!")
print('''
You may now have the permission to talk to the bot! HV
''')
import time
time.sleep(2)
import random
l = (bot_name + ":Hello!", bot_name + ":Hi!", bot_name + ":Hello!")
random_greeting = random.choice(l)
print(random_greeting)
def openinput(input):
return print(input(f"{user_name}{':'}"))
if "how are you doing today" in openinput(input):
print({bot_name} + 'Very Well! Thank you for asking :)')
elif "hi" in openinput(input):
print('Hi!!')
else:
print("ERROR1.0: It seem's like my index doesn't answer your question.")
The error:
Traceback (most recent call last):
File "app.py", line 26, in <module>
if "how are you doing today" in openinput(input):
TypeError: argument of type 'NoneType' is not iterable