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.
Also, names
should_return_the_correct_properties_for_given_sum
,Should_pass_shuffled_tests
, andShould_pass_random_tests
are not uniformly formatted. All of them either should start with uppercase or lowercase.I also would like to add that creating a new random engine for every test is rudimentary.
Describe
is a struct, so this has to be done instead:Looks pretty good! Couple of notes (first three are important; third is stylistic):
std::vector<int>
is a poor fit for this Kata since the return value should carry exactly 4 items. Choose any of the following instead:std::tuple<int, int, int, int>
. If you think it's too wordy, dousing PyramidInfo = std::tuple<int, int, int, int>;
and use the aliasPyramidInfo
thereafter. Include<tuple>
for this onestd::array<int, 4>
. Include<array>
for this onestruct PyramidInfo { int vertices; int edges; int faces; int sides; };
#include
out of preloaded and instead put it explicitly in the solution setup. Do not hide headers (and yes, this means you also need to#include <utility>
wherever you usestd::pair
).Assert::That(pyramid(sumValue), Equals(expected), ExtraMessage("Incorrect output for sum = " + std::to_string(sumValue)));
. Include<string>
for this one. For fixed tests just hardcode theExtraMessage
s.std::mt19937 rng{ std::random_device{}() };
in one line rather than 3. Also, the C++ distributions are inclusive, so you don't need to add 1 to the end value --distr(150, 10000)
is what you probably intended.Nice and mathy kata to learn some theory with.
actually very informative, thank you
Also, make it accessble using
request.form.get
as wellSpecified to use POST request parameter
"code"
but was not found inattempt
test. OK, it makes sense for the usual test, I use an if-else statement to catch if it'sNone
, but it's alwaysNone
. Great idea once again, but requires some fixingGreat kata idea! However, sometimes the code runs too slow and won't fit inside of the time limit. Try using a
For more documentation, refer to https://docs.codewars.com/languages/python/codewars-test/
and your code with a literal
import
statement within function is efficient?pewhapz we needs more sample tests?
because there are only 2 of them and they do not catch your specific error
what
how is sample test working fine then
your condition is wrong
This comment is hidden because it contains spoiler information about the solution
You're splitting the string twice in the above code, whereas by adding the extra line you only split the string by spaces once.
Loading more items...