volvonumber1 commited on
Commit
3eeeade
·
verified ·
1 Parent(s): 650f764

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -0
README.md ADDED
@@ -0,0 +1 @@
 
 
1
+ class SimpleAI:2 def __init__(self):3 self.responses = {4 "hello": "Hi there! How can I help you?",5 "how are you": "I'm just a program, but thanks for asking!",6 "albania": "Albania forever!",7 "bye": "Goodbye! Have a great day!"8 }910 def respond(self, user_input):11 # Normalize the input to lowercase12 user_input = user_input.lower()13 # Check for keywords in the user input and return the corresponding response14 for keyword in self.responses:15 if keyword in user_input:16 return self.responses[keyword]17 return "I'm not sure how to respond to that."1819def main():20 ai_instance = SimpleAI()21 print("Welcome to the AI! Type 'bye' to exit.")2223 while True:24 user_input = input("You: ")25 if user_input.lower() == "bye":26 print(ai_instance.respond(user_input))27 break28 response = ai_instance.respond(user_input)29 print("AI:", response)3031if __name__ == "__main__":32 main()