It's time to build a real AI. This chatbot will have a Memory (Dictionary).
If it doesn't know an answer, it will ask YOU to teach it. Then it remembers forever!
We store knowledge as Question : Answer pairs.
Define a dictionary called `brain` with at least one greeting.
brain = {
"hello": "Hi there!"
}
Define `user_input` as something the robot DOESN'T know yet (e.g., "weather").
user_input = "weather"
Check if key exists. If not, add it! This is Learning.
if user_input in brain:
print(brain[user_input])
else:
print("I don't know that yet!")
brain[user_input] = "It is sunny."
print("Thanks! I learned it.")
1. If you run the code again with "weather", what happens?