def f(x):
    """ Target function for the perceptron learning algorithm.  I've
    chosen the NAND gate, but any function is okay, with the caveat
    that the algorithm won't terminate if ``f`` cannot be computed by
    a perceptron."""
    return int(not (x[0] and x[1]))