A basic rule-based chatbot built with Python that responds to predefined user inputs using keyword matching.
This is a beginner-level Python chatbot that uses a dictionary of hardcoded question-answer pairs to simulate conversation. It matches user input against known keywords and returns a corresponding response.
- Responds to greetings and farewells
- Answers basic general knowledge questions
- Solves simple arithmetic expressions
- Case-insensitive input handling
- Fallback response for unrecognized inputs
- Language: Python 3.x
- Libraries Used:
random(built-in)
- Make sure Python is installed on your system.
- Clone or download this repository.
- Open a terminal and navigate to the project folder.
- Run the script:
python chatbot.py- Start chatting! Type
byeto exit.
Chatbot: Hello! I'm a simple chatbot. You can start a conversation, or type 'bye' to exit. You: hello Chatbot: Hello! How can I help you? You: tell me a joke Chatbot: Why did the scarecrow win an award? Because he was outstanding in his field! You: 2+2= Chatbot: 4 You: bye Chatbot: Goodbye!
📦 simple-chatbot ┗ 📜 chatbot.py
- Only responds to predefined inputs — no NLP or AI involved
- Cannot handle complex or multi-turn conversations
- Arithmetic is hardcoded, not computed dynamically
- Add NLP using
nltkortransformers - Integrate a machine learning model for dynamic responses
- Add more topic coverage
- Build a simple GUI using
tkinter
Anushka Kendre