-1

I created an AI called Rhyme, and can't not get this one question correct. Every time I ask it "What day is it today?" It responds "The date is <built-in method today of type object at 0x57b048334c80>". How do I fix it? This is my code.


command_dictionary = {
   "HELP": "I am an technology-based AI created by Theodore Skutar in 2023, that can create simple coversations with humans! I don't have much knowledge or power, so if you would like more out of me, email me at skutartheo32@gmail.com for ideas. Everything has to be perfect when giving me commands, so remember to add uppercases and punctuation so that I will work! To stop the AI, type EXIT",
   "Hello!": "Hi there!",
   "How are you?": "Since I am an AI, I have no feelings but I am programmed doing well, thank you!",
   "What is your name?": "My name is Rhyme.",
   "Who created you?": "Theodore Skutar created me in 2023.",
   "What is your gender?": "Because I am an AI, I have no gender but I am programmed to be a boy.",
   "Are you a boy or a girl?": "Because I am an AI, I have no gender but I am programmed to be a boy.",
   "How many coding languages are there?": "There are 250 - 2500 coding langauges including Python, JavaScript, HTML, C+, C++, R, PHP, and so much more!",
   "What is your favorite coding language?": "Hence I am an AI, I have no favorite coding language, but I am programmed to love Python.",
   "What day is it today?": f"The date is {date.today}",
}

while True:
 user_input = input("Give me a command: ")

 if user_input.upper() == 'EXIT':
     break

 if user_input in command_dictionary:
   print(command_dictionary[user_input])
 else:
   print("Sorry, I don't have a response for that. Try searching on google.ca or chat.openai.com")
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • Deferred evaluation, or in other words, a lambda function instead of a string. You'll also want to use the date formatter to get clean output. – tadman Aug 18 '23 at 14:47
  • How do I do that? – MiniSkoot32 Aug 18 '23 at 14:50
  • 1
    Change "What day is it today?": f"The date is {date.today}", to "What day is it today?": f"The date is {date.today()}", – Tom G Aug 18 '23 at 14:54
  • This simple typo is a common beginner error, but I can't find a good duplicate. I'm simply voting to close as typo. – tripleee Aug 18 '23 at 20:06
  • https://stackoverflow.com/questions/66720961/function-calls-with-without-parentheses discusses this but it's buried inside a `tkinter` problem. – tripleee Aug 18 '23 at 20:07
  • Does this answer your question? [Why does my code print "built-in method" and some hex numbers?](https://stackoverflow.com/questions/35321701/why-does-my-code-print-built-in-method-and-some-hex-numbers) – He3lixxx Aug 30 '23 at 01:38

0 Answers0