Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
related (dang i need to finish the faq and get it moved to CW wiki somehow)
Well, you published this as a CW kata. CW katas are intended to be public site content done by all CW users, so they are subjected to a certain level of standard. If it's intended for non-public use you'd be better off not publishing the kata and keep it in draft. People with the link can still complete it (though they wouldn't be able to submit solutions).
Why is it important to have random tests?
My primary intended audience are some coworkers with limited coding experience or just SQL experience; I'd like to broaden their experience into R and Python. I'm concerned adding more complexity will add more confusion without a corresponding benefit.
Thanks, specified in description.
Fixed, thanks!
There should have random tests. The current setup doesn't allow setting up random tests easily (because
iris
is global), so perhaps it'd be a better idea to pass the dataset and the column name as function arguments.Sample test spoils the answer.
Which standard deviation are you talking about, sample or population standard deviation?
The description does not provide enough information to determine which one to be used.
approved
why did you give up on displaying the input in assertion messages ? It makes the user experience a lot better on Codewars. Note that you can also do it for fixed tests (and reduce the boilerplate/copypasting at the same time) by extracting the assertion to a function:
Also, could you add a return value in the initial code (e.g.
0.0
) to make the datatype that the function should return extra clear ?Should be fixed, thanks!
you should not print to the console: remove the
print()
calls in your solution (print(chance)
) and in the random tests (print(paste(n, x, a))
).Instead of the latter, to show the input to the user, use the
info
keyword-parameter of expect_equal():random tests expect
0.0
most of the time. Increase the range ofn
from1 - 500
to1000 - 5000
to correct thatWhen authoring a translation, you do not have to make a line-by-line translation of the original kata. Use what is idiomatic in your target language. For example,
50+sample(1:40, 1)
is an artifact of original JavaScript version which used modulo to generate numbers. you can writesample(50:90, 1)
directlyR Translation: https://www.codewars.com/kumite/6541b0d6da59f6b54ae55194?sel=6541b0d6da59f6b54ae55194
First time doing a translation, let me know if anything is off.