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.
This comment is hidden because it contains spoiler information about the solution
I usually write my code in an outside environment and save my progress onto my computer. Once i feel that it is done, I just copy and paste it into the codewars terminal!
While testing for the array of size 100000, it says that I complete the test, but then it shows the "Max Buffer Reached: Too much information has been written to stdout. Process exited prematurely with a SIGKILL signal." error. I understand that the console just runs out of space, but then how has anyone finished this kata?
This comment is hidden because it contains spoiler information about the solution
Can someone please explain to me why this is a legal operation? I have not come across this before and am interested in knowing why this works.
@jci55
,My guess would be dumb luck? You've raised an interesting point. I just tried with the
sale_percentage
set to0
and I do get theZeroDivisionError
with my solution. But the katas solution code also has the same result.On the one hand, it seems odd to have
sale_percentage
ever be100%
since a "store" would just be giving something away for free. Google seems to think "sale" means "the exchange of a commodity for money; the action of selling something" or "a period during which a retailer sells goods at reduced prices". According to those definitions, it seems like an oxymoron to have a100%
sale.If a
99%
sale was agreed to be the highest percentage possible, only one number would need to be changed to ensure nobody else gets one (or more) random tests withsale_percentage == 100
.On the other hand, if
100%
is agreed to be a validsale_percentage
, at least one new hard-coded test should be added and the kata solution must be modified (since it also raises aZeroDivisionError
).Hopefully that helps to answer your question. Thanks for the comment!
at first I had something like this, but it didn't like it when the sale percentage was 100, as it created a divide by 0 error. do you know why that wasn't the case for you?