-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbasic.py
28 lines (22 loc) · 931 Bytes
/
basic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import random
import datetime
responses = {
"hello": "Hello! How can I help you?",
"how are you": "I'm just a computer program, so I don't have feelings, but I'm here to assist you!",
"what's your name": "GUBBU AI",
"bye": "Goodbye! Have a great day!"
"what's your name": "I'm a simple AI chatbot.",
"bye": "Goodbye! Have a great day!",
"time": datetime.datetime.now()
}
def chat_with_ai():
print("AI: Hello! I'm your friendly chatbot. Ask me anything, or just say 'bye' to exit.")
while True:
user_input = input("You: ").lower() # Convert input to lowercase for case insensitivity
if user_input == "bye":
print("AI: Goodbye! Have a great day!")
break
response = responses.get(user_input, "AI: I'm sorry, I don't understand that. Please ask something else.")
print("AI:", response)
if __name__ == "__main__":
chat_with_ai()