I was making a simple chatbot ai Most of these codes are copied from others, so I don't know why the error is occurring.
def get_response(intents_list, intents_json):
tag = intents_list[0]['intents']
list_of_intents = intents_json['intents']
for i in list_of_intents:
if i['tag'] == tag:
global result
result = random.choice(i['responses'])
break
return result
I've tried deleting global, but then I get another error. And I tried to rename the variable, but it still makes an error. From what I searched, it seems to be a range-related problem, but I don't know how to solve it.
All I know is that there was an error in return result.