Create lesson1_task1.py

pull/34/head
Stephen Howell (MSFT) 3 years ago committed by GitHub
parent 04dc85a21d
commit c14150ecb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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!")
Loading…
Cancel
Save