6 kyu

The Hackers’ Taunt

Description
Loading description...
Lists
Arrays
Recursion
  • Please sign in or sign up to leave a comment.
  • KayleighWasTaken Avatar

    Test output is legitimately horrendous:

    • No assertion messages for fixed tests
    • Giga page stretcher in random tests rather than using assertion messages
  • DrillToHeaven Avatar

    Thank you very much for kata approval!!!!

  • Blind4Basics Avatar

    Hi,

    • You don't need to do a deep copy of the input, since the call to the user's function is the very last thing done with it.
    • random_string() should be ''.join(random.choices(letters, k=random.randint(3, 6))), and letters should be defined outside of the function
    • issue part: 90% of the tests expect an empty string. That's because the random input generation is way too much constrained. It should be possible to randomly insert strings at any depth.

    Cheers

    • DrillToHeaven Avatar

      Hi! Thank you so much for telling!! I have tried to adjust the random input generation and it seems to be okay now. And thank you for telling about random.choices, I didn't know there is such a convenient way of generating strings!! I changed it to use random.choices! Can I also ask you about passing the deep copy of the input? So as long as I call the user's function after computing the expected output it is fine but then do we need to pass a deep copy for the fixed tests or this is also fine?

    • Blind4Basics Avatar

      I didn't notice about the fixed tests. You don't need the deep copy there either, yes.

      About the random generator, I have to say... I'm worried about these conditions: if current_depth != 1:. Why? Strings should appear anywhere in the structure, whatever the depth.

    • DrillToHeaven Avatar

      Thank you for explaining about fixed tests! As for that condition, I made it like that because initial idea was that the main list have lists and those lists have either strings or other lists and I noted that in the rules. I was actually also thinking that it would probably make more sense to switch it so just strings anywhere but something stopped me from doing it. I quickly tested my solution with the strings in the depth 0 just now and it seemed okay, so if everything goes fine, I will change it tomorrow to include them as you advised! Thank you!!

    • DrillToHeaven Avatar

      Hi! I am sorry, I will have to put it off until tomorrow, I wanted to do it this evening, but I have a strong headache and feel like a vegetable. I remember about the promise and will definitely do it.

    • Blind4Basics Avatar

      there's no hurry, don't worry.

    • DrillToHeaven Avatar

      Thank you!! I have just updated the spec and all of the tests to include strings in the shallowest 0 depth. It looks now so much better with them ! :]

    • Blind4Basics Avatar
      Issue marked resolved by Blind4Basics 3 months ago