diff --git a/NLP/1-Introduction/solutions/lesson1_task1.py b/NLP/1-Introduction/solutions/lesson1_task1.py new file mode 100644 index 00000000..ca36fcbc --- /dev/null +++ b/NLP/1-Introduction/solutions/lesson1_task1.py @@ -0,0 +1,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!")