Ad
  • Custom User Avatar

    The statistics module doesn't accept non-positive (zero and negative numbers). It also performs operation on floats and doesn't guarantee exact results. See here.

  • Custom User Avatar

    Tests for mutation should be using identity (a is b) instead of equality (a == b). Two piles can be equal is their data is the same, and this also enables some interesting options that subclass other immutable types such as tuple and str.

  • Custom User Avatar

    Starting code for python translation has a variable r while kata description specifies variable a.

  • Custom User Avatar

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

  • Custom User Avatar

    Imagine that each non list item has a default depth of zero. A sublist will have a depth of 1 (itself) plus the maximum depth between each of its items.
    Thus, you get with the recurrence formula depth = 1 + max(depth(item) for item in list)

    Recursively, this person's code calculates the depth of each item within the argument l and adds 1 for the depth of l itself.

  • Custom User Avatar

    Because it will see hole number #9 to it's right while doing so running towards the wall. Or should it be blind to its sides while running towards its first wall, but able to see normally elsewhere?

    Just tested it, and it seems all cockroaches are blind to their sides and diagonals until their first turn. I think it'd be better to specify it in the kata description, as well as what's the expected priority.

  • Custom User Avatar

    I don't understand how random tests are supposed to work, in this case it says there is no cockroach that'd enter the 9th hole, but shouldn't roach R on the last line be able to?

    Random test #1:
    +--8-----------01----------------5
    |                                |
    |        D                       |
    |    D                           |
    |       L                        |
    4                                2
    |                                |
    |                                |
    |                                |
    7                           R  D |
    |                 R            D |
    +--------------3--------9--------6
    
    EXPECTED = [0, 0, 2, 2, 1, 0, 2, 0, 0, 0]
    
  • Custom User Avatar

    Random tests in Python expect a single specific path while providing a graph with multiple valid shortest paths.

  • Custom User Avatar
  • Custom User Avatar

    It works because self.area of Rectangle is defined within the parent class Shape

  • Custom User Avatar

    There is no fixed test for Nearly There, my code passed all tests despite being wrong.

  • Custom User Avatar

    bc stands for basic calculator

  • Custom User Avatar

    Either way you'd have to loop through all digits, and Counter has at most ten keys.

  • Custom User Avatar

    I think the kata description should've mentioned that labels/coroutines themselves can be "run over" and the program should just ignore them. I've spent a lot of unnecessary time trying to wrap my head around that recursive power function due to this (@Blind4Basics and @AnitaK comments helped a lot, but all necessary information should be available in the kata description or tests).

    Also, even though it's not tested, I think the kata's description should mention that indentation has no particular meaning, since that implies labels/coroutines can be nested.

  • Custom User Avatar

    This kata needs better tests, some examples have multiple valid paths.
    Given miner M, exit E and open path 0:

    both [right, down] and [down, right] are valid paths
    M 0
    0 E
    
    # both [right] and [down, right, up] are valid paths 
    M E
    0 0
    
  • Loading more items...