5 kyu
Build a quadratic equation
308 of 385wowthecoder
Loading description...
Mathematics
Strings
Algebra
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
consider displaying input value instead of "One random test" for each random test.
Okay, I'll handle this special case. Okay, I'll handle this other special case. Okay...
Removal of multiples of 0 was not mentioned in the description.
Example and sample tests like below should be added
Description also does not mention that
m
andp
will never be0
, alson
andq
can be0
Description should be language-agnostic (removal of function names)
Removal of multiples of 0 was not mentioned in the tasks.
ie something like 6x^2+0x-1. should become 6x^2-1.
This is actually an issue!
This comment has been hidden.
No, it's not available on codewars:
https://docs.codewars.com/languages/python
Thanks
i have the problem with one test case on python i have this answer y^2-5y-66 but it should be 55y^2-599 y-66 i think it's incorrect case because My program in case (𝑦−11)(55𝑦+6) got 55y^2-599 y-66 and in case (y-11)(y+6) got y^2-5y-66 and it is correct Plese check this test case I've complete all test except this one
Okay so I tried your code and it seems that for the test case (-y+11)(-55y-6) your answer is y^2-5y-66, which is wrong. The answer should be 55y^2-599y-66. I think maybe it's caused by the "-y" in the first bracket which doesn't have a number coefficient? By the way my test case doesn't include (y-11)(y+6). Please check your code again and let me know if there are any further problems.
Thanks, really my bug , found an error - I missed one index
.
Traceback (most recent call last): File "tests.py", line 2, in from solution import quadratic_builder File "/workspace/default/solution.py", line 1, in import sympy as sym ModuleNotFoundError: No module named 'sympy'
Why? My first solution on the 'sympy' module has 23 lines. But getting an error, I decided not to use modules. And my cat became very fat ...
I think it's because the sympy module is not supported in codewars. I didn't explicitly add any code in my test cases to disallow any modules.
Thank you for your answer and for the kata.
Nice kata! I've submitted a C++ translation
Approved! :D
Wow! Love this kata! Very Niceee!!
Approved :)
a
orb
is1
,the1
has to be omitted;x^2+1x+2
(note the1x
), which should not be correctThanks a lot for the feedback! I will change it as soon as possible.
@anter69 I have added a few new fixed test cases, but your code still seems to work though. If your solution originally returns the wrong answer, then how can it still work now? I think your original solution is correct, but thanks for the suggestions anyway :)
I submitted a new solution in the meantime
I see the tests and the description is fixed, so closing the suggestion
Fun Kata!
Thanks @XRFXLP for editing and improving my kata test suite. Finally now I can understand FArekkusu's earlier request about wrapping the referrence solution. Sorry for being rude earlier, but I must say FArekkusu did not explain his requests clearly. And for reading the documentation, I did read it but the docs are very vague on how to handle reference solutions inside the test suite. Anyway thanks for the help and sorry for the inconvenience caused. @FArekkusu it would be better if you can explain clearly what issues you want me to fix the next time, I am still a newbie :)
Sample tests are still not in a
describe
block. Sample tests still don't import the solution. Random tests are still not in adescribe
block.Stop closing issues without fixing anything. You were given a link to the documentation - use it ffs.
I am trying, all right. I already followed the documentation(which is not very clear to be honest) as good as I can. I don't know what you want now. The test suite works nicely with clear indication of example tests, fixed tests and random tests, yet you seem to be very particular about the format of putting
describe
andit
blocks. Can you at least provide some examples of importing the solution and putting tests in "appropriate blocks"?If what you want is for me to put an
it
block for every test case I have, I think you haven't noticed that I have 41 tests, not just a few. Why do I have to waste time to seperate individual test cases when I can just group them together?What do you mean? I have literally put the line
@test.describe("Example Tests")
on top of the sample test method.What now? I changed the method in the
assert_equals()
fromquadratic_builder
tosolution.quadratic_builder
and I have addedimport solution
in the beginning.he is talking about the random tests, not the fixed ones a "describe" on top of the random tests is fine, but also put an "it" around each individual random test
Ahh so that's what he was talking about. Thanks @dfhwze Please be more specific next time @FArekkusu. And just for clarification, the issues on importing the solution and sample tests have been fixed.
Ok an "it" has been put around each individual random test
The sample tests still don't import the solution...
Please, learn the terminology instead. "Sample/example tests", "fixed tests", "random tests", "reference solution", "fixture" etc. all have well-established meaning.
@author : In the "example test" section do "from solution import quadratic_builder", apparently my first edit was shadowed by yours.
Okk noted changing it now
Yay done now :D Everything should be alright now.
Sample tests and random tests should use
it
blocks. The solution should be imported explicitly. The reference solution should be inside adescribe
or anit
block.Ok I have added the fixes you suggested, except this:
What do you mean by reference solution? Are you referring to the method I put in the test suite to solve the random test cases? I tried to put the method inside a
describe
orit
block, but it gives me errors. The original method works fine, so I am just going to leave it as it is.To clarify, the reference solution is the solution you enter seperately to the tests. It is your submission to the kata (Hence, the reference solution).
Yea as I said I tried to follow FArekkusu's advice to wrap the reference solution inside a
describe
orit
block, but both did not work and threw errors. the other issues about appropriatedescribe
andit
blocks have been fixed I guess, unless FArekkusu have some other demands to my test suiteThere're already quite a few katas which require parsing/formatting polynomials, and if you strip this away, the task essentially becomes "add/multiply a bunch of numbers". IMO this is really bad and uninspired.
Well I already got a few ideas for other katas, but I just thought I should get one of it approved first. Then my first try just got retired, and now my idea is said to be unoriginal. If it is this hard to produce a good kata, then I might as well not waste my time on creating katas anymore. Everyone seems to have some bad opinions on my FIRST kata. I completely understand that some of those opinions are issues that need to be fixed, but comments like this^ is very discouraging for new kata creators like me. Documentation isn't clear(no clear examples) too, so how I am supposed to know how to do stuff like writing a good test framework or writing random tests properly?
And about my idea being bad and uninspired, I have checked and there are no duplicates to my kata. If my idea is bad, what about all those quadratic equation katas that asks you to find the roots? I found quite a number of duplicates(some still in beta), but they all get good ratings. What did I do wrong?
I am sorry if I sound rude or stupid, just expressing my feelings towards the kata creating process.
It's very similar to Binomial Expansion. Though, I wouldn't call it a duplicate. What do others think?
There are similarities, sure. However IMO it's not a duplicate, the other kata is clearly harder, mathematically and about the parsing task, it would be rather a sort of easier previous step in a kata's series.
New test framework should be used, and the reference solution should be inside a relevant
describe
/it
block.Can you show me how to do that? I am new to this creating kata process. Thanks
https://docs.codewars.com/languages/python/codewars-test
Ok I have updated my test framework. I have included
describe
/it
blocks to describe my test cases. Thanks mauro-1 for the link :)By the way I already have a java translation, so if you want to make a translation for this please don't make a java translation
This is a duplicate of my retired kata "Quadratic Equation Builder" that was automatically retired because of the initial issues. I put in quite a lot of effort in it and I think it would make a great kata, so here I am with with the republished kata. All the issues in the previous kata have been addressed and fixed! Please approve this kata! I would really appreciate it if my kata get pass the beta process. Thanks to everyone that raised issues on my first kata so that I can fix it :)