You've already forked ui-cviko1
2.2 KiB
2.2 KiB
In [10]:
import random
no_responses = [
"I can't answer that.",
"I don't know, sorry.",
"I can't understand you.",
"Can you elaborate, please?"
]
responses = {
"What's the weather like today?": [
"It's sunny!",
"It seems sunny today.",
"Sunny."
],
"What is your name?": [
"My name is AI-CHATBOT.",
"It's AI-CHATBOT.",
],
"What's your favorite color?": [
"It's yellow.",
"Yellow."
],
"What color is the sky?": [
"The sky is blue.",
"It's blue."
],
"Can you talk?": [
"No.",
"Nope.",
"I can't do that."
]
}
while True:
message = input("> ")
if message == "bye":
print("< Bye")
break
if message in responses.keys():
print("<", random.choice(responses[message]))
else:
print("<", random.choice(no_responses))
In [ ]: