Ask coding questions

← Back to all posts
Issue with Python Dictionary
h
InvisibleOne

I'm messing around with a bot that you can talk with, and part of the idea is that if it doesn't know what you are asking it, you can tell it to reply with. It is supposed to add this to it's dictionary of replies, and if I print out the dictionary I can see that it did, but if I try and ask it to do that, it doesn't work. Here's the repl: https://repl.it/@InvisibleOne/Testing-Interesting-Stuff#main.py

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
InvisibleOne
Comments
hotnewtop
Coder100

Why isn't reply_dict global?

InvisibleOne

Good point, I'll try that @Coder100

Coder100

awesome, gl @InvisibleOne

InvisibleOne

🤯 That worked, I should have noticed that, now I feel stupid

Coder100

lol awesome!! @InvisibleOne

InvisibleOne

test