import random
class Chatbot:
def __init__(self):
self.responses = []
def add_response(self, response):
self.responses.append(response)
def generate_response(self, input):
response = random.choice(self.responses)
return response
# Create a chatbot instance
chatbot = Chatbot()
# Add some responses to the chatbot
chatbot.add_response("Hello!")
chatbot.add_response("How are you?")
chatbot.add_response("What's up?")
# Get the user's input
user_input = input("What do you want to say to the chatbot? ")
# Generate a response from the chatbot
chatbot_response = chatbot.generate_response(user_input)
# Print the response
print(chatbot_response)