Ad
  • Default User Avatar

    C Translation (author inactive).

  • Custom User Avatar

    It would be worthwhile to include handling of edge cases at the beginning of the solution. You need to make sure that the function handles edge cases correctly, such as when a or b is 1.

    An example of handling edge cases:

    def number_of_sets(a, b):

    if a == 1 and b == 1:
    
        return 1 # Case (1, 1, 1) satisfies the conditions
    
  • Custom User Avatar

    If we're evaluating continued fraction, why isn't the returned value a Fraction?

  • Default User Avatar

    I've come up with a solution (python) that seems to work for this problem, I pass the test phase but when I do the attempt, it fails seemingly randomly with this error :

    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 33, in random_tests
        test.assert_approx_equals(cf_value(arr), expected)
      File "/workspace/default/src/codewars-test/codewars_test/test_framework.py", line 84, in assert_approx_equals
        div = max(abs(actual), abs(expected), 1)
    TypeError: bad operand type for abs(): 'NoneType'
    
    

    The tests are then completly stopped.

    I do return None in some of my code, but it is intended and within the rules (as far as my understanding goes). What surprises me is that this error do not look like an intended response from the test but rather that the assert does not expect a None return, resulting in the testing framework crashing as a whole.

  • Custom User Avatar
    • Function name should be in snake_case
    • The result should be a float
    • New test framework should be used
    • The user can modify the input
    • Trivial map/filter/reduce is not a novel idea
  • Default User Avatar
    test.assert_equals(number_of_sets(1, 0), 0)
    0 + 0 + 1 = 1
    0 * 0 * 1 = 0
    

    Why is the expected result 0?

  • Custom User Avatar

    I would suggest to change kata's category from "Puzzles" to "Basics".