Ad
  • Custom User Avatar

    Fixed.

    Changed -1 to 0 (with backward compatibility).

    Updated random tests (old tests never generate 0/-1).

  • Custom User Avatar
  • Default User Avatar

    i love this one, definitely clever.

  • Custom User Avatar

    break not brake, use None/0 instead of -1

  • Default User Avatar

    0 could be a good idea for the beauty of solutions.

  • Default User Avatar

    "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?

  • Default User Avatar

    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)

  • Default User Avatar

    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.

  • Custom User Avatar

    Or just 0 (would make sense)...

  • Default User Avatar

    s/brake/break

    consider None over -1

  • Default User Avatar

    Fair point.

    Mind sharing your opinion on the kata description?

  • Custom User Avatar

    (if you ask for a confirmation, that means you're not sure hence, don't close the issue)

  • Default User Avatar

    Solutions using sqrt() for validation should no longer pass.
    The one that you posted is not passing anymore for two reasons:

    • it assumes that square can't be constructed using one stick
    • it uses sqrt() for validation

    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.

  • Default User Avatar

    Done :)

  • Default User Avatar

    I do not know yet how to fix it but I will figure it out.

  • Loading more items...