Chatbot
Chatbot
import random
responses = {
"how are you": ["I'm good, thanks for asking!", "I'm doing well, how about you?"],
"default": ["I'm not sure what you mean...", "Could you please rephrase that?", "Sorry, I didn't
understand."],
def generate_response(user_input):
if user_input in responses:
return random.choice(responses[user_input])
else:
return random.choice(responses["default"])
def main():
while True:
if user_input.lower() == 'exit':
print("Chatbot: Goodbye!")
break
response = generate_response(user_input)
print("Chatbot:", response)
if __name__ == "__main__":
main()