6 kyu

Pair items from two lists of different lengths

118 of 128user2553318
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Quite a complex kata, I guess getting the correct pairing combinations is what's challenging about it.

  • Blind4Basics Avatar

    It is nowhere stated that each sublist has to contain the maximum amount of tuples possible. From what I read in the descrtiption it could also be possible to return sublists with only one pair in the examples.

    => That's an issue. And to sustain that, the first sample test using "codewars" should be added to the description.

  • Madjosz Avatar

    Python: The second sample test

    test.expect(pair_items([1], [2, 3]) == [[(1, 2)], [(1, 3)]] or [[(1, 3)], [(1, 2)]])
    

    is rubbish since the order of operation is (actual == expected1) or expected2 and expected2 is a non-empty list, so True-ish.

  • Madjosz Avatar

    It is nowhere stated that each sublist has to contain the maximum amount of tuples possible. From what I read in the description it could also be possible to return sublists with only one pair in the examples.

  • Hamburgler Avatar

    In the python tests it's really annoying that you simply get an error message "Value is not what was expected" when your test fails instead of the expected and actual results.

  • user2553318 Avatar

    Changed python tests to allow any order of inner lists (also see updated description). The Ruby tests may also need to be adjusted.

  • Unnamed Avatar

    Ruby sample tests:

    expected: [[[1, 2], [1, 3]]] got: [[[1, 2]], [[1, 3]]]

    expect(pair_items([1], [2, 3])).to eq([[[1, 2], [1, 3]]]) This looks incorrect. Compare to Python: test.assert_equals(pair_items([1], [2, 3]), [[(1, 2)], [(1, 3)]])

  • Unnamed Avatar

    Some Python solutions call len on the input and they pass all current tests. Either it should be guaranteed that the input iterables have known lengths or tests against this should be added.

  • Unnamed Avatar

    takes two iterable objects

    Ruby has strings in the sample tests. Strings are not iterable in Ruby.

  • FArekkusu Avatar

    Ruby translation. Please, review and approve.

  • UlrichBerntien Avatar

    The function must return a list of lists.

    The order of the inner lists is defined in the task description: "maintaining the order of the items". But the order of the lists in the list is not defined in the task description.

    The test fails if the lists are not in the correct order. But the correct order is not specified. Only by trial and error I found a solution.

  • Opabinia Avatar

    This comment has been hidden.

  • zLuki Avatar

    I don't understand why I have to return some pairs twice. For example "abc" and "xy": Why aren't the pairs ax, ay, bx, by, cx, cy?

  • FArekkusu Avatar

    The user can modify the input.