def half_adder(a, b):
    """
    A binary half adder -- performing addition only using logic operators,
    A half adder simply adds two bits and outputs a sum and carry
    """

    # ^ is logical xor in python
    sum = a ^ b
    carry = a and b
    return carry, sum