Ad
  • Custom User Avatar
  • Custom User Avatar

    Fixed.

  • 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

    Why is this an issue? its more of a suggestion.

  • 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,

    By exactly same Kata rules.

    shouldn't roach R on the last line be able to?

    Why?

    That cockroach will head RIGHT (as you look at the floor). Then it will hit the right-side wall. Then it will turn left (from the bugs POV) which means it will go into hole #2

  • 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.

  • Loading more items...