Ad
  • Custom User Avatar

    Your solution fails because of the conditional statement used to determine whether to return the correct message. In the code, if haystack == True is not a valid check for whether the 'needle' is in the array, as it incorrectly evaluates the entire list as a boolean, which is always true when the list is non-empty. Therefore, your code always returns "not found the position of the needle" regardless of whether the needle is present.

    (🤖)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution