• ###### gaelanmcmillancommented on "Break camelCase" python solution

Oh, that's good to know, thanks!

• ###### FArekkusucommented on "Break camelCase" python solution

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.

• ###### gaelanmcmillancommented on "Break camelCase" python solution

String concatenation in Python always results in a new object, meaning reconstructing s with repeated concatenation (+=) is an O(len(s)^2) operation.

From the docs:
"Concatenating immutable sequences always results in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length."

It's better to construct a list and join it after the fact, as appending to a list (a mutable object) is constant, regardless of the length of the list or s.

• ###### WestwardLand968created a suggestion for "Calculate Average of 5 Rubik's Cube Solves" kata

The description could be more condensed instead of pasting the whole rulebook into it.

• ###### WestwardLand968created a suggestion for "Calculate Average of 5 Rubik's Cube Solves" kata

500 random tests is too much, 100 is enough.

• ###### WestwardLand968created an issue for "Calculate Average of 5 Rubik's Cube Solves" kata

I know for this kata it is difficult to change it; but returning different data types is bad practice.

• ###### Kacarottcommented on "Calculate Average of 5 Rubik's Cube Solves" kata

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.

• ###### user9644768commented on "Calculate Average of 5 Rubik's Cube Solves" kata

You really do not need to `import math`, integer division with 1 should've done the job.

• ###### Kacarottcommented on "Calculate Average of 5 Rubik's Cube Solves" kata

@mjaydenkim To reiterate, you should `import math` at the top of the tests, since you use `math.floor` within the tests. This will solve the error FArekkusu was getting.

• ###### Voilecommented on "Calculate Average of 5 Rubik's Cube Solves" kata

`round(2.675, 2)` gives `2.67` instead of `2.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.

• ###### Kacarottcommented on "Calculate Average of 5 Rubik's Cube Solves" kata

Not disagreeing with the proper method, but isn't that example correct? I don't understand the point you are making with it.

• ###### Voilecreated an issue for "Calculate Average of 5 Rubik's Cube Solves" kata

Current input method and rounding requirement is flawed anyway; try this:

``````test.assert_equals(ao5([2.675, 2.675, 2.675, 2.675, 2.675]), 2.68)
``````

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-round

• ###### Voilecreated an issue for "Calculate Average of 5 Rubik's Cube Solves" kata

The implementation of `real_round` provided by the kata is flawed: it doesn't accepts the `ndigits` 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 like `round_half_up`.

• ###### mjaydenkimcommented on "Calculate Average of 5 Rubik's Cube Solves" kata

You shouldn't need to import math, I don't believe--I think you can just use `real_round()` without importing (since it's in the preloaded file) and without importing math (because math is imported in the preloaded file), at least when it's preloaded. `import math` has been moved to the initial solution, though. I'm sorry if I'm misunderstanding