Practical Exercises
Exercise 1: Rule-Based Chatbot
Task: Implement a rule-based chatbot that can answer basic questions about a fictional company's contact information, hours of operation, and services offered.
Solution:
def rule_based_chatbot(user_input):
"hello": "Hello! How can I assist you today?",
"hi": "Hi there! What can I do for you?",
"what are your hours of operation?": "Our office is open from 9 AM to 5 PM, Monday to Friday.",
"where are you located?": "We are located at 123 Main Street, Anytown, USA.",
"what services do you offer?": "We offer web development, mobile app development, and digital marketing services.",
"bye": "Goodbye! Have a great day!"
user_input = user_input.lower()