Hint
🧠 Not sure where to start?
Here’s how you can break this down step by step:
Print a welcome message so the user knows what to do.
Use a
while True
loop to keep the conversation going until the user types something like'exit'
.Get the user’s input inside the loop:
message = input("You: ")
Make it case-insensitive by using
.lower()
:
if "hello" in message.lower():
print("Chatbot: Hi there! How can I help you today?")
elif "bye" in message.lower():
print("Chatbot: Goodbye! Have a nice day.")
elif message.lower() == "exit":
break
else:
print("Chatbot: I’m not sure how to respond to that.")
✅ That’s really all there is to it.
Click Show Solution to see this put together into a simple but complete chatbot!