A simple Python rule-based chatbot built for CodeAlpha – Python Programming Internship (Task 4).
Author: Adarsh Singh
Build a simple rule-based chatbot that responds to basic user messages.
- The user types a message in the console.
- The bot checks the message for certain keywords (like "hello", "how are you", "bye", "joke", "weather", "help").
- Based on the keyword matched, it replies with a predefined response.
- If no keyword matches, it gives a fallback response.
- The conversation ends when the user types "bye" or "goodbye".
if-elifconditionals- Functions
- Loops
- Input/Output
- Make sure you have Python 3 installed.
- Download
basic_chatbot.pyfrom this repo. - Open a terminal in that folder and run:
python basic_chatbot.py - Type messages like
hello,how are you,tell me a joke, orbyeto chat with the bot.
You: hello
Bot: Hi! How can I help you today?
You: how are you
Bot: I'm fine, thanks! How about you?
You: tell me a joke
Bot: Why do programmers prefer dark mode? Because light attracts bugs!
You: bye
Bot: Goodbye! Have a great day.
basic_chatbot.py– main program
Part of the CodeAlpha Python Programming internship – Module 1, Task 4. Created by Adarsh Singh