7 kyu

Mean Means

745 of 1,252tibor_r
Description
Loading description...
Mathematics
Algorithms
Algebra
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • Adeline_02 Avatar

    My code passes all tests except one, but I believe this is true.

    "8.015856437398833 should equal 8.015856437398835." This is an error on the second check

    What should I do to pass the kata?

  • ejini战神 Avatar

    JS: function and parameter name should use camelCase

  • ejini战神 Avatar

    C#:

    • Method name should be PascalCase (Please refer to implementation of backward compatibility here )

    • Floating point comparison should be used in assertions instead of rounding both actual and expected results

  • sikach_illia Avatar

    14.3259057835044 should equal 14.325905783504401

    7.733044285559698 should equal 7.7330442855597

    all other tests passed (python)

  • shakir53621 Avatar

    This comment has been hidden.

  • Cybersamurai  Avatar

    i tried just using the statistics module, I don't know why it failed

  • codeApe Avatar

    I was able to provide solution for the basic test and random tests but the extended test was given me this error: Test Failed Expected: 7.7330442855596999d But was: 6.8737933528262785d

    What could be the probable C# solutions?, i tried some Math methods like Floor(), Ceiling(), Abs(), Round() already. Thank you

  • Blind4Basics Avatar

    python:

    • the sample test do not use the test framework
    • the fil test suite is not using the decorator version of the test framework

    @johan: very good job...

  • User554 Avatar

    This comment has been hidden.

  • benjaminzwhite Avatar

    This comment has been hidden.

  • joshred83 Avatar

    This comment has been hidden.

  • joshred83 Avatar

    This comment has been hidden.

  • PDrich101 Avatar

    passed every test in Python, nonetheless not able to submit due to this error:

    Traceback (most recent call last): File "/workspace/default/tests.py", line 43, in test.assert_equals(round(abs(geo_mean(list(arr), mean)), 5), TypeError: bad operand type for abs(): 'NoneType'

  • JohanWiltink Avatar

    Kata very much needs the below fork approved.

  • JohanWiltink Avatar

    JS fork with

    • update to Node 18.x
    • actually working, correct random tests
  • GuyL99 Avatar

    one of the best katas I've seen so far!

  • eb110 Avatar

    Description should to be improved " Arithmetic mean = (1 + 3 + 9 + 27 + 81) / 5 = 121 / 5 = 24.2 Geometric mean = (1 * 3 * 9 * 27 * 81) ^ (1/5) = 59049 ^ (1/5) = 9" Why you are dividing and powering the result two times? "/ 5 = 121 / 5 = 24.2; (1/5) = 59049 ^ (1/5) = 9"

  • Sanderas Avatar

    In order to solve this task we only need to understand how test work. There is some double call the function in the tests.

  • agkg Avatar

    This comment has been hidden.

  • Voile Avatar

    JS random tests is generating lots of noise which results in undefined.

    Can you please validate your random test cases before passing it to user function to eliminate the noise?

  • simosini Avatar

    python... There is definitely something wrong with random tests... I tried printing out the result before yielding it and i see something like: (my computed result printed) log: res -> -23.111 (test result) Error 24.653 should equal -23.111 Either you swapped the arguments in the test or i dont get it

  • Hackito Avatar

    Python: I can't figure out why this is True: Test.assert_equals(geo_mean([1, 2], 3), 2.2894284851066637) The missing number is 6, because (1+2 + X) / 3 = 3; X = 6 So, the answer is sqrt(6 * 2) ~ 3.464

    Any help?

  • anter69 Avatar

    In the description you mention "imaginary" numbers multiple times -- however, I believe you mean "irrational" ( or simply "real") numbers. I suggest to remove it altogether, as it may be confusing, and it doesn't affect the kata at all.

  • myjinxin2015 Avatar

    I don't think that your random tests works, although I didn't test it

  • user5036852 Avatar

    C#-Translation kumited! (With random tests)

    https://www.codewars.com/kumite/57cc296d58a06bf62200021d

    Please check and approve it! :-)

  • tibor_r Avatar

    I'm unable to re-publish - server keeps timing out.

  • PG1 Avatar

    This comment has been hidden.

  • Omnia89 Avatar

    This comment has been hidden.

  • Casparwaters Avatar

    On one of the random tests I get nan should equal nan. Is this an error in the test case or in my code? Nan is designed to not equal itself in order to prevent errors returning values, so i dont see how this can ever be passed.

  • suic Avatar

    Hi, few things to Python version:

    1. Missing random tests
    2. You should specify some rounding

    I've edited the description e. g. [1,4,7,4] is not a set in Python or in maths.

    Regards,

    suic

  • myjinxin2015 Avatar

    Add some random tests please(JS)