Build a beginner-friendly rule-based chatbot in Python that responds to predefined user inputs using only conditional logic.
- Uses only Python standard library features
- Uses
if-elif-elsestatements for chatbot decisions - Runs continuously with a
whileloop until the user exits - Converts user input with
lower()for simple matching - Includes a fallback response for unsupported inputs
- Supports greetings, introductions, study questions, fun replies, math, date, time, mood, personal questions, and exit commands
- Prints a welcome message when the chatbot starts
- Prints a goodbye message before exiting
- Python 3
- Standard Library:
datetime
- Download or clone the project folder.
- Make sure Python 3 is installed on your computer.
- Open the project folder in a terminal or VS Code.
Run the chatbot with:
python chatbot.py- hi
- hello
- hey
- what is your name
- who are you
- who made you
- how are you
- how is your day
- thank you
- good morning
- good night
- help
- menu
- commands
- what is python
- what is ai
- what is machine learning
- tell me a joke
- tell me a fact
- motivate me
- what time is it
- what is today's date
- add
- multiply
- square
- i am happy
- i am sad
- i am bored
- do you like me
- are you human
- can you think
- bye
- exit
- quit
Bot: Welcome! Type 'exit' anytime to leave.
User: hi
Bot: Hello! Nice to meet you.
User: what is your name
Bot: My name is RuleBot.
User: what is ai
Bot: AI stands for Artificial Intelligence.
User: help
Bot: Available commands:
- hi
- hello
- hey
...
User: bye
Bot: Goodbye! Have a nice day.
Rule-Based-AI-Chatbot/
├── chatbot.py
├── README.md
└── requirements.txt
- Using
if-elif-elsefor decision making - Working with
whileloops - Handling user input in Python
- Building a simple console application
- Using basic functions to keep code organized