Untitled
import time def chatbot(user_input): user_input = user_input.lower() if "hello" in user_input: return "Hello! How can I help you today?" elif "how are you" in user_input: return "I'm just a computer program, but I'm here to help!" elif "bye" in user_input: return "good bye" elif "time" in user_input: current_time = time.strftime("%H:%M:%S") return current_time def chat(): print("Hello! I'm a chatbot. type exit to exit from me?") while True: user_input = input() if user_input.lower() == "exit": print("Goodbye!") break response = chatbot(user_input) print(response) chat()
Leave a Comment