You need to sign in or sign up before continuing.×
Ad
  • Default User Avatar

    Ok I adjusted the prices to integers so the problem should be gone. Thanks

  • Custom User Avatar

    Try [0, 10, 0, 1, 0], 13.5. 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.5 = 13.499999999999998

  • Custom User Avatar

    Could you tell me what do you exactly mean with roundig issues.

    You would have to create some test cases (for example some many random tests) where total price is equal to the budget, use your current reference solution in tests, and try to solve it with my solution based on fractions. Depending on some factors, my solution might not pass because your reference solution would produce inaccurate results and would reject my solution.
    Some info can be found in this article and articles linked from there.

  • Default User Avatar

    Ok i deleted JavaScript, adjusted my tests so return False isnt a solution anymore, I also changed shoppingList and x. Could you tell me what do you exactly mean with roundig issues.

  • Custom User Avatar
    • JavaScript translation should be deleted because it's a dummy code from a new kata.
    • return False passes all random tests.
    • Type of inputs where total price is equal to x is needed to weed out solutions which have rounding issues
    • ... what brings us to the problem that with floats you will most probably run into rounding issues
    • ... and to the problem that the name x is not great (and shoppingList does not conform to Python naming conventions).

    Please take a look at Python translations of Leap Years or Even or Odd for some ideas about organization of test suites.

  • Default User Avatar

    Now there are random tests

  • Custom User Avatar

    There are no sample tests, or random tests. And only 2 fixed tests.

    Please read the kata authoring guideline before creating a kata, period.

  • Default User Avatar

    Thank you for pointing that out.

    I now added random tests.

    Thank you for helping me improve this Kata.

  • Default User Avatar

    I cannot fathom why individuals resort to cheating at Codewars. Such conduct is inconceivable and should not be condoned.

  • Default User Avatar

    I know both individuals, and I can state without doubt that they are the most deceitful individuals I have encountered.

  • Custom User Avatar

    When I hit "attempt", it shows an error:

    File "/workspace/default/tests.py", line 8
        def test_time_management():
    IndentationError: unexpected unindent
    

    Can you please fix that?

  • Default User Avatar

    Thank you for completing my first Kata and for your comment.
    I updated the Kata regarding that issue.

  • Custom User Avatar

    Hi, why did you cheat on the only blue kata you completed? This is what you submitted, which is exactly the same as a very commonly copied solution.

    You also submitted this as your only purple kata solve, which is structurally the same as another submission by another new user within the same PxC clan, at roughly the same time frame.

    Please don't cheat together.

  • Custom User Avatar

    Hi, why did you cheat on the only blue kata you completed? This is what you submitted, which is exactly the same as a very commonly copied solution.

  • Custom User Avatar

    Reality issue: clocks don't go from 1 to 24, but from 0 to 23. Also description says

    The first integer defines the current hour of the day (1 to 24)

    Actual tests contain current_time = 0 inputs.

  • Loading more items...