• Custom User Avatar

    That code works for any other case except [[]], why is it so hard to use an if before that and simply return an empty array when the input is exactly that? I don't see the problem.

  • Custom User Avatar

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

  • Custom User Avatar

    Anyone here had some success in creating an empty array in Python?

    Sure, it's super easy:

    empty_list = []
    

    I see that you're trying to turn a list into a string and then parse it back into a list. Are you trying to avoid input mutation? The standard library has a module called copy for that, in particular, you might find the copy.deepcopy function very useful. Docs: https://docs.python.org/3/library/copy.html#copy.deepcopy

  • Custom User Avatar

    Write something like this:

    if (input is [[]]) return [] 
    

    You need to figure out how to properly write that if condition, it's not the literal solution, just some pseudocode.

  • Custom User Avatar

    I wish I could understand. Anyway, thanks for helping.

  • Custom User Avatar

    Short-circuit your code, you won't apply it to that case. Use an if, it's as easy as that.

  • Custom User Avatar

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

  • Custom User Avatar

    Why are you not returning an empty list? [0] is not an empty list, neither is [None]. There is no issue, you're not doing what you should do.

  • Custom User Avatar

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

  • Custom User Avatar

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