Ad
  • Custom User Avatar

    Thank you, Flurin. I guess you've offered about as much help as possible. Yeah, I suppose helping with the math would maybe be too much. Looks like someone hid your last comment (wasn't me). I need all the help I can get. Thanks, again.

  • Custom User Avatar

    Do I have to create my own list/array of the values? I noticed the values (n) aren't the actual values in the pyramid. So, how do you work with something that doesn't exist? It's pretty easy if the values are there, but this doesn't explain how you get the values. It just acts like they're already there.

  • Custom User Avatar

    I just tried again, with a plain old simple for loop, where my 'sz' variable just increments based on the 'size', and it just dies. The system just cannot handle a for loop for the large numbers, so how are you doing the math? How do you come up with a math formula that does the same thing as a for-loop?

  • Custom User Avatar

    Right, you created this, Kata, didn't you? So, if we can count them, and we see the pattern and everything, how do we come up with the math to solve it? The problem is that an array doesn't work. It times out. So, how did you come up with the math to solve it? If I use math based on row-by-row, it would be like 7+1+6+3+5+2+7, so how did you use that example as a way to solve every problem, all the way up to 568 kazillion?

  • Custom User Avatar

    Thanks, Trumny. I'm not that smart, so I don't follow the logic there. It did give me the idea of focusing on the black squares, instead of the white squares, but I doubt that helps.

    Yeah, I started using similar logic, where I just added the 'size' (N), and then just doubled ever other lower number, like 5 * 2, 3 * 2, and dropped them in an array or variable, but that doesn't work and times out. So, if you're showing me some way that involves straight math, I don't see it. I see you're showing me what looks like it might be some pattern, but I just don't see it. The only pattern I see is that one I mentioned before, where there are two sides for each of every other number lower than N/'size'.

    So, this is really frustrating, because like I mentioned before, I can figure these all out multiple ways for all of the numbers below 500,000, but it's not until it goes over 500,000 that the patterns stop working.

  • Custom User Avatar

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

  • Custom User Avatar

    OK, thanks. I searched for 'None', and I did find a section that looked like it might've been the part you're talking about. So, I tried to 'return' the value I was printing, but it did no good. Am I on the right track with using return, instead of print?

  • Custom User Avatar

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

  • Custom User Avatar

    Basic Test Cases
    Log
    'Hello, John!'
    None should equal 'Hello, John!'
    Log
    'Hello, Alice!'
    None should equal 'Hello, Alice!'
    Log
    'Hello, World!'
    None should equal 'Hello, World!'
    Unexpected exception raised
    Traceback (most recent call last):
    File "/workspace/default/src/codewars-test/codewars_test/test_framework.py", line 111, in wrapper
    func()
    File "tests.py", line 18, in basic_test_cases
    test.assert_equals(hello(), "Hello, World!")
    TypeError: hello() missing 1 required positional argument: 'name'