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.
Fixed.
Changed
-1
to0
(with backward compatibility).Updated random tests (old tests never generate
0
/-1
).best
i love this one, definitely clever.
break not brake, use None/0 instead of -1
0 could be a good idea for the beauty of solutions.
"Having a failure share representation with success can lead to failures accidentally being treated as success."
If you can treat negative length of the side as a success it means you didn't understand the task. You can't have a piece of stick of a negative length.
"If not knowing about the possible None, that is still better than not knowing about the possible -1, being forced to deal with it is the whole point."
None can be an indicaion that there occured some case that your code didn't take care of. I still opt for -1 as an indication of no square case.
"s/brake/break"
I didn't understand it. Where is it? How did you come across it?
Having a failure share representation with success can lead to failures accidentally being treated as success. By making them different you make it difficult or impossible to mix them up.
If not knowing about the possible None, that is still better than not knowing about the possible -1, being forced to deal with it is the whole point.
If 0 can be considered a success then keeping it as int makes sense. A square having a side of -1 would be something very different though.
If the sentiment is that you don't like mixing types, then I would still consider int|NoneType to be a single type, a union of two others. Exceptions are another way to represent that, again keeping failure and success separate.
(It still says brake btw)
I would like the output to remain integer.
Both 0 and -1 make equal sense to me, both indicate that there can be no square constructed.
Or just
0
(would make sense)...s/brake/break
consider
None
over -1Fair point.
Mind sharing your opinion on the kata description?
(if you ask for a confirmation, that means you're not sure hence, don't close the issue)
Solutions using sqrt() for validation should no longer pass.
The one that you posted is not passing anymore for two reasons:
Thank you for your feedback!
If there is anything else to fix in any of your issues please reply.
For now I mark all 3 of them as resolved.
Done :)
I do not know yet how to fix it but I will figure it out.
Loading more items...