Ad
  • Default User Avatar

    drodger, Thx.

    PavlovNikita,
    This is only a 'clever' way to solve it and not either the only way to solve it or the most readable way to solve it. I personally prefer longer code when it is more easily readable. However, sometimes, it is efficient to do it in a single-line/shorter-code.

    After joining codewars, I have tried to be terse with code to learn terseness. So, now, I try to balance both as ultimately code needs to be read and re-read and maintained.

    Thx

  • Default User Avatar

    Found that it "passed all tests" when I clicked on "Attempt".

  • Default User Avatar
    1. I completed the function 'search_names'.
    2. I then used the filter function and passed the function name as the 1st argument.
    3. I am not sure what iterable name to pass as 2nd argument because using the same list name 'a' as given in the tests does not work.
  • Default User Avatar

    Nice Kata.
    Spent hours trying to figure out a faster solution to locating the n-th number in the sequence and finally...
    As @ziereis wrote, you will use brute-force but in the right way. If done so, the code will churn out more than 150 numbers in less than 1 second.
    I am actually rofl reflecting upon the path I was struggling with for all those hours.

  • Default User Avatar

    I am using the law of sines to find out the angle between R and F2.

    For all testcases, I get the 'R' (Resultant Force) correct. However, for a few testcases, the angle betwen R and F1 is incorrect. Some of the errors are listed below(Order of data given is F1, F2, θ, R, φ):

    1. 150 107 112 214.4151852100284 27.561099384454977 (27.561099384454977 should be close to -27.56109938445498 with absolute or relative margin of 1e-09)
    2. 84 153 3 69.25479361508799 6.639521967323551 (6.639521967323551 should be close to -173.3604780326765 with absolute or relative margin of 1e-09)

    Sincerely appreciate any insight into what I could be doing wrong.

  • Default User Avatar

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

  • Default User Avatar

    Nice Kata. KH!, Thanks for making me ROFL and teaching me not to be serious while coding.

    1. I had attempted this Kata quite some time ago. I guess I was too serious about coding. I thought and thought and then decided to put it on the back-burner.
    2. Today, I attempted this as this is the last remaining Kata of 8 kyu. As usual, I started out thinking that this is a serious problem.
    3. For some reason, I leaned back for a moment and suddenly it struck me that this is the simplest problem- I had gotten fooled by the Kata description.

    Thanks with deep gratitude to all the Kata creators. I have been able to complete all the Katas in 8 kyu without unlocking the solution for any of the Katas.

  • Default User Avatar
    1. Nice Kata. Though my solution worked, it was very verbose compared to what others submitted.
    2. Instructions aren't clear enough but figured out what was being asked for after running some tests with print statement.
    3. Thanks to "acraileanu" and other solution providers.
  • Default User Avatar

    Superb Kata. It was difficult and painful but in the end I will say that it was enjoyable. After submitting my solution, I found that there are much more efficient solutions. Though my solution worked it was verbose. So, I learnt a LOT!.

    Thanks to the Kata-Creator, ExaStencil and everyone else whose comments preceded mine.

  • Default User Avatar

    Nice- I like this kata. All the information was/is provided in the description. It is a matter of reading the description carefully- a necessary trait for a programmer to model the problem in code.

  • Default User Avatar
    1. This isn't as much a coding problem than a Google-ing and understanding the formula for obtaining the total pressure exerted by the gas molecules (homogenous and/or otherwise).

    2. So, to prevent/reduce frustration (no point spending time Google-ing):
      molar_mass1 & molar_mass2 - molecular mass in grams of gas 1 and gas 2 respectively.
      given_mass1 & given_mass2 - mass in grams of gas 1 and gas 2 at given temperature respectively.

    So, pressure, P = ((M1 + M2) * R * T) / V
    where M1 & M2 are the number of molecules of gas 1 and gas 2 for the given masses.

    1. I hope my comments for each variable/factor in (2) above are accurate if not correct.

    2. Did not mark this as 'spoiler content' because I am not sure if I am giving away anything that I shouldn't.

  • Default User Avatar

    Instructions are confusing. Was this done on purpose? Finally...the solution is simple. Cannot give any hints/suggestions without spoiling it for the coder.

  • Default User Avatar

    Gotcha!
    I misunderstood the last rule. Thanks a lot.

  • Default User Avatar

    The following testcases are incorrect:
    Ranomized Tests:
    [1] is invalid : True should equal False
    [4, 5, 6] is invalid : True should equal False
    [2, 4] is invalid : True should equal False
    [1, 3, 5, 6] is invalid : True should equal False
    [1, 3] is invalid : True should equal False
    [3, 5, 6] is invalid : True should equal False
    [2, 5, 6] is invalid : True should equal False
    [3] is invalid : True should equal False
    [2, 3, 5, 6] is invalid : True should equal False
    [2, 4, 5, 6] is invalid : True should equal False
    [1, 4] is invalid : True should equal False
    [1, 5, 6] is invalid : True should equal False
    [2, 3] is invalid : True should equal False
    [4] is invalid : True should equal False
    [2] is invalid : True should equal False
    [5, 6] is invalid : True should equal False
    [1, 4, 5, 6] is invalid : True should equal False

    How come the single digit testcases ([1], [4], [2]) failed when the below passed?
    [8] is valid

    Also, the rules state that 5 and 6 should be together or shouldn't be there at all. So, why should [5,6] return False?

    Thanks for listening.