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.
python new test framework is required. updated in this fork
This comment is hidden because it contains spoiler information about the solution
Oh, that's good to know, thanks!
That's not true anymore (at least in some cases). CPython now includes an optimization where building up a string like this doesn't create any intermediate copies.
This comment is hidden because it contains spoiler information about the solution
The description could be more condensed instead of pasting the whole rulebook into it.
500 random tests is too much, 100 is enough.
I know for this kata it is difficult to change it; but returning different data types is bad practice.
Ah ok, I understand. I was not sure how acceptable it was to use rounding in this kind of kata (which is supposed to emulate some kind of 'real world' requirement), where rounding issues could be considered a part of the task. But if it's bad CW practice I guess its bad CW practice.
You really do not need to
import math
, integer division with 1 should've done the job.@mjaydenkim To reiterate, you should
import math
at the top of the tests, since you usemath.floor
within the tests. This will solve the error FArekkusu was getting.round(2.675, 2)
gives2.67
instead of2.68
because of floating point inaccuracies.In any case, there are some specific values where this will happen, which is why doing decimal rounding over floating point range is a bad idea.
Not disagreeing with the proper method, but isn't that example correct? I don't understand the point you are making with it.
Current input method and rounding requirement is flawed anyway; try this:
The proper method to it is to use
Decimal
object to parse time strings as decimals directly; see https://www.codewars.com/kata/round-and-roundThe implementation of
real_round
provided by the kata is flawed: it doesn't accepts thendigits
optional parameter.Also calling it
real_round
is disgustingly misleading; Banker's rounding is the real round since it's recommended by IEEE standard. The function should be called something faithful and accurate likeround_half_up
.Loading more items...