memory = {}
num = {}
def chat(msg):
if msg.startswith("覚えて "):
key, value = msg[4:].split("=")
memory[key.strip()] = value.strip()
return "覚えたよ"
if msg.startswith("忘れて "):
key = msg[4:].strip()
if key in memory:
memory.pop(Q)
return "忘れたよ"
else:
return "知らないな"
if msg in memory:
return memory[msg]
return "知らないな"
while True:
user = input("You: ")
if user == "end":
break
print("AI:", chat(user))
To embed this project on your website, copy the following code and paste it into your website's HTML: