write me a simple chat bot python code about recycling

1 answer

Certainly! Here's a simple chat bot python code about recycling:

```python
import random

# Function to generate random bot responses
def get_bot_response(user_response):
bot_responses = ["Recycling is important for the environment.",
"You can recycle materials like paper, plastic, glass, and metal.",
"Reducing waste, reusing items, and recycling are the three key elements of waste management.",
"Always clean and empty your recyclables before putting them in recycling bins.",
"Be sure to check the recycling guidelines specific to your area, as they may vary.",
"By recycling, we can conserve natural resources and reduce pollution.",
"Recycling one aluminum can saves enough energy to power a TV for three hours.",
"Remember to buy products made from recycled materials to support the cycle of recycling."]

return random.choice(bot_responses)

# Main function for running the chat bot
def chat():
print("Bot: Hi, I'm a recycling bot. How can I help you today?")
while True:
user_response = input("You: ")
user_response = user_response.lower()

if user_response in ["bye", "goodbye", "exit", "quit"]:
print("Bot: Goodbye! Have a great day.")
break

bot_response = get_bot_response(user_response)
print("Bot:", bot_response)

# Run the chat bot
chat()
```

The chat bot generates random responses about recycling. It provides information on the importance of recycling, types of materials that can be recycled, recycling guidelines, and interesting facts about recycling. It continues the conversation until the user enters "bye", "goodbye", "exit", or "quit".