forked from microsoft/ML-For-Beginners
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
26 lines (22 loc) · 997 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import random
# This list contains the random responses (you can add your own or translate them into your own language too)
random_responses = ["That is quite interesting, please tell me more.",
"I see. Do go on.",
"Why do you say that?",
"Funny weather we've been having, isn't it?",
"Let's change the subject.",
"Did you catch the game last night?"]
print("Hello, I am Marvin, the simple robot.")
print("You can end this conversation at any time by typing 'bye'")
print("After typing each answer, press 'enter'")
print("How are you today?")
while True:
# wait for the user to enter some text
user_input = input("> ")
if user_input.lower() == "bye":
# if they typed in 'bye' (or even BYE, ByE, byE etc.), break out of the loop
break
else:
response = random.choices(random_responses)[0]
print(response)
print("It was nice talking to you, goodbye!")