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.
Thanks. Inattention is my credo:)
Order of results is specified ( and
@bizzua
, yours is the other way around ).Approximate comparison reraised as
Issue
. Closing this one.Floating point values should be compared for approximate equality. See Docs.
Comparing floating point values for strict equality is actually an
Issue
. This often happens when kata deal with floating point values; it is documented here.Handling floating point representation inaccuracy wrong is a good way to collect downvotes from frustrated solvers.
[-0.21170577194406404, -37.78829422805593] should equal [-37.78829422805593, -0.21170577194406448]
please make the comparison approximate
and may be some rules for the order of the roots (or even better, take the roots in any order, and check the sorted roots in the test)
I was re-write this case. Now garantiered that case a=b=c=0 not proved.
I was hesitant to suggest an exception, because it didn't seem to fit the situation. However, solving
0 = 0
forx
is simply not applicable,x
is not even in there. It's not just a degenerate case, it's undefined what even should be happening here. Why solve forx
? Might as well solve forpi
.Raising an exception would be the most sensible solution, as there's no way to return an answer of the consistent type (i.e., a list of roots).
The normal return type is a list of numbers. When infinitely many answers exist, the return type should still be a list of numbers ( and, unfortunately, you can't test for an infinite list ). That is what "consistent return type" means, and what strong static typed languages will actually enforce. A string is simply not always even a possibility.
Maybe 'roots are any real number'?
Yes, it is not float type, but understendly for users that meens.
Might
Infinity
be a valid return value for other polynomials? If it is ( though I can't imagine a polynomial with non-negative degrees which actually has a root at infinity ), that would make it not a good choice, but if not, it would be.[float('inf')]
I suggest you do one thing: either parse the polynomial from a string, or find roots. ( I think both are duplicates though. )
at first, I wanted to set the condition in a different way. Inputing the string like '2x^2 + 4x + 5 = 0' and needs find roots. But i think that it hard for 7 kyu and for 6 kyu it not interesting to solve this kata.
That you think, maybe make case of '2x^2 + 4x + 5 = 0' and gives it on 6 kyu?
Inconsistent return types is not good kata design. Find another way to signify infinite solutions.
Loading more items...