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.
Hi5 Davo36!
Why are programmers so like "Oh it was so easy, I did it in 10 minutes..."
I'm a 1Kyu, so not stupid but I've spent a couple of hours on this and can't solve it. It's obviously a math problem, not a coding one.
A formula or pattern or what have you can be elusive. I'd say it's harder then a 6kyu.
Because this has a complexity of O(n²) which is awful
It's a very simple thing to program given you know the pattern. In fact, that's true for almost any codewars problem. If you know or understand the problem, it should be quite easy. This problem is just particularly easy because it's only one to two lines.
Arguing "intent" outside of kata description and tests is a fool's errand. Maybe the kata author believed one of the problems with the code was that it needlessly concatenated two constant strings? We have just as much evidence for that as anything else, which is to say: none.
I solved the kata in this way to avoid concatenating constant strings. It's a waste of CPU, there's no compelling reason to accept that waste, no requirement asking me to, and no test that fails if I do things my way. So I did things my way.
Anyone who says this code is "cheating" or "wrong" is barking up the wrong tree. An accepted solution is never wrong or cheating; it is the tests that are wrong. It is up to them to work with the kata author to improve the kata, or fork it and do it themselves. It is not a coder's responsibility to intuit beyond the requirements what the author "intented", and further, doing so is a fool's errand, more likely to be wrong than not.
Finally, in general finding unintended solutions is a huge benefit to the Codewars community. It illustrates non-conventional thinking (which often results in better solutions, especially in the higher kyus) and forces kata authors to improve their katas and tests.
While I understand if someone's cheating to get to their rank, that can feel like it diminishes the "value" of your rank, but:
I'm curious as a beginner if your approach, which seems to ignore the intent (as the given code includes concatenation), is based on industry best practices, or simply to stick it to kata creators who write ambiguous instructions (or are these one in the same?)? Either way, it's fun to see solutions that think outside the box.
thanks! yes, I really only wrote it to demo this vulnerability
Note: Pyhthon 3.8 and above
That is one of the differences between python 2 and 3. I used python 2 back then.
Yours is just as good.
issueS confirmed:
23 errors!)(as a matter of fact, my solution passed while I:
that's ESPECIALLY BAD! x/ )
I assume those are Python tests, I could check javascript later.
Test.assert_equals(cake(0,""), "Fire!")
doesn't make sense because there were no candles to start with, so something is wrong with that test.Test.assert_equals(cake(0, "jpipe"), "That was close!")
this one too, because you can't drop candles that don't exist. In fact the candles dropped should be less than or equal to the total number of candles.It would help if you present some of those cases.
That's because f-strings are a new feature of Python version 3.6.0.
Check out this blog post for more info and considerations on f-strings.
This comment is hidden because it contains spoiler information about the solution
Loading more items...