Skip to content

Simple chatbot using Python dictionaries def simple_chatbot(user_input): responses = { "hi": "Hello! How can I help you?", "what's your name?": "I'm SimpleBot, your virtual assistant!", "how are you?": "I'm just a program, but I'm here to help you!", "bye": "Goodbye! Have a great day!", } # Convert user input to lowercase for matching user_input = user_input.lower() # Return response or default message return responses.get(user_input, "I'm not sure how to respond to that.") # Start the chat print("SimpleBot: Hello! Ask me anything (type 'bye' to quit)") while True: user_input = input("You: ") if user_input.lower() == "bye": print("SimpleBot: Goodbye!") break response = simple_chatbot(user_input) print(f"SimpleBot: {response}") #19

Open
@Keerthu262

Description

@Keerthu262
No description provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions