You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
No description provided.
The text was updated successfully, but these errors were encountered: