Ad
  • Default User Avatar

    Just make "length = len(list(s))" if you need to know it.

  • Custom User Avatar

    Any whitespace at the end of the line should also be stripped out.

    It's because of that.

  • Custom User Avatar

    If the array of arrays is null/nil or empty

    null is not the same as an empty array. You can't read the length of null and that's what the error is about.

    You have a typo in your code:

    if(lengthArray.lenth){
          return 0
      }
    

    It's length, not lenth. But fixing that would break your code.