Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • Loved this kata! I exploited a symmetry I found, but I don't really understand how my solution works.

  • This kind of cleverness takes my breath away, ha!

  • lol i was wondering if this would pass the tests. nice 1.

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

  • Invert the bits from index i to index j. If the given number is '1010' and it said ['I',2,4] then you would 'flip' (change from 1 to 0 or vice versa) the bits from index 2 to 4 and get '1101' (indexes start at 1 and not 0 for some reason).

  • thanks for the comment, I was stuck at this exact test with the exact issue you were mentionning. Saved from hours of frustration!

  • The test below can be cheated easily.

  • @l2iisk
    Did you get resolution on this? I ran into the same issue.
    You're kinda going down the wrong path.

    Let me know if you need further clarification.

  • rather about classes, I'd say... x) ;)

  • Ok. I think I'll have to stew over this and/or do more research about python dictionaries.

  • well, that's questionnable... The description isn't precise enough, imo. The original version is in JS where things are done differently. But one could considere that you're somehow failing this requirement instead:

    You need to make a function that takes an object as an argument, and returns a very similar object but with a special property.

    problem being: "similar to what point?"

    answer: don't reinvent the wheel ;) (but that doesn't change the fact that the description might need a small update, at least about python)

  • subject = partial_keys(o)
    @test.it('should not have extra keys')
    def __():
        test.assert_equals(subject, o)

    Considering the fact some people create their own classes from scratch in Python, it should be mentioned that either the user's output must support comparison with dict instances (which means adding an anticheat), or it must implement their own items(self) method (which means rewriting this test to compare the input's and output's key-value pairs). Otherwise, they fail with zero information about what's wrong.

  • @Blind4Bassics
    'you're actually not "failing the requirement", '

    !!!Then my answer should be correct and the test needs to be fixed!!!!

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

  • you're actually not "failing the requirement", but you're failing the assertion because of the way it's done. Here it is:

    test.assert_equals(your_object, original_dict)

    gather your thoughts around this and try to think about what your implementation is missing.

  • Loading more items...