Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 

Repository files navigation

CodeAlpha_BasicChatbot

A simple rule-based chatbot built in Python, created as part of the CodeAlpha Python Programming Internship (Task 4).

πŸ“Œ About

This program simulates a basic conversation using keyword matching. The user types a message, and the chatbot replies based on predefined rules β€” no AI or external libraries required.

✨ Features

  • Responds to greetings, "how are you", name questions, and thanks
  • Case-insensitive and forgiving input matching (e.g. "Hello!" and "hello" both work)
  • Multiple exit keywords: bye, goodbye, exit, quit
  • Handles empty input gracefully
  • Improved version includes varied, randomized responses for a more natural feel

🧠 Concepts Used

  • Functions
  • if-elif-else conditional logic
  • while loops
  • Input/output handling
  • Lists and the in operator
  • random.choice() for response variety (improved version)

πŸ›  Requirements

  • Python 3.7 or higher (no external libraries needed)

▢️ How to Run

  1. Clone this repository:
    git clone https://github.com/<your-username>/CodeAlpha_BasicChatbot.git
    cd CodeAlpha_BasicChatbot
  2. Run the script:
    python chatbot.py
    Or run the improved version:
    python chatbot_improved.py
  3. Type a message and press Enter. Try:
    • hello
    • how are you
    • what is your name
    • thanks
    • bye (to end the conversation)

πŸ“„ Example Conversation

Chatbot: Hello! I'm your CodeAlpha chatbot.
Chatbot: Type 'bye' anytime to end our conversation.

You: hello
Chatbot: Hi! How can I help you today?

You: how are you
Chatbot: I'm fine, thanks! How about you?

You: bye
Chatbot: Goodbye! Have a great day.

πŸ“ Project Structure

CodeAlpha_BasicChatbot/
β”œβ”€β”€ chatbot.py             # Basic version (matches PDF requirements exactly)
β”œβ”€β”€ chatbot_improved.py    # Enhanced version with varied responses
└── README.md              # Project documentation

πŸŽ“ Internship

This project was built for the CodeAlpha Python Programming Internship.

About

A simple rule-based chatbot built in Python for the CodeAlpha Python Programming Internship.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages