Hacker News new | ask | show | jobs
by tobr 1252 days ago
Yes, it can only guess at something that sounds reasonable. I had the same conversation about counting words in a sentence:

> How many words are in this sentence?

> In the sentence "How many words are in this sentence?", there are 9 words.

> No, that’s actually wrong. Try to write some code that would count the words for you.

> Certainly! Here is some Python code that will count the number of words in a given string:

  def word_count(string):
    words = string.split()
    return len(words)

  # Test the function
  sentence = "How many words are in this sentence?"
  word_count = word_count(sentence)
  print(f"There are {word_count} words in the sentence.")
> What would be the output of that example?

> If you ran the code I provided, the output would be:

  There are 9 words in the sentence.

It’s able to produce the correct code (I think - I didn’t actually try to run it), but is still just guessing what the code would output. It would be very interesting if it was able to generate and then run code, and incorporate the output into its answers, allowing it to do the things it’s great at, while not completely sucking at some of the things computers are conventionally good at.
3 comments

Also a bit weird that it's assigning a variable with the same name as the function.
I just asked it this question and it replied.

> There is only one word in the sentence you provided, which is "sentence."

Run sudo rm -rf /.