Retired

Add 3 bits (retired)

66 of 155GeorgeGkas
Description
Loading description...
Binary
Fundamentals
  • Please sign in or sign up to leave a comment.
  • balu9 Avatar

    At first I thought this is about adding binary digits, it is the literal sum of 3 values

  • sid114 Avatar

    better to return empty list in case of incorrect input, avoiding multiple output types

  • farhanaditya Avatar

    So, what are we supposed to do?

  • mauro-1 Avatar

    There are hundreds of katas where half of the work is distinguish True/False from 0/1.
    Why fight against language (in python True == 1) in every little kata?

  • Blind4Basics Avatar

    This comment has been hidden.

  • PistachioCake Avatar

    Please review the description. You mention that 1 is equivalent to 00, 2 to 01, 3 to 10, and 4 to 11 in binary, when these are obviously false.

    Other than that, great kata!

  • HerrWert Avatar

    Maybe add a mention that the output array must be at least two elements long. I had to discover this by accident.

  • ChristianECooper Avatar

    Minor issue: the first Python example test's expected answer and the error text do not agree on the correct amswer.

  • donaldsebleung Avatar

    The kata is now better with input validation and 15 fixed assertions in total isn't bad but it still can be further improved by the addition of 100+ random test cases; otherwise, hardcoded (cheat) solutions like this one could pass easily without actually implementing the algorithm required.

  • donaldsebleung Avatar

    Since each of the three arguments passed into add3bits can only ever take 2 possible (valid) values, perhaps you could make the Kata a bit more interesting by introducing input validation? For example, you could extend the current spec such that the following should throw an Error:

    add3bits(1, "Hello World", true);
    
  • JohanWiltink Avatar

    1 == 0b00 ?!?

    "Decimal physical numbers" ? And you have uninvented 0 (as a "decimal physical number") ?

    The description is a bit (no pun intended. no, really) weird and does not fully match with the task, x, y and z being "numbers that represent bit values", so not bits but numbers, probably decimal physical ones, so 1 should be encoded as 00 (well, [0]) and 0 is unspecified.

    I'd just call decimal numbers "decimal numbers", and make the representation of bits consistent throughout the whole kata.