Right. I should've used a threshold. Fixed now.
print where(outputs > .5, 1, 0)
The example is for OR. In general, inputs is mxn matrix. m - training instances and n features. targets is training output matrix. In this case its 4x1 for 4. I see sometimes, it doesn't converge after those iterations perhaps because of initial weights. There are other techniques I have to use like momentum.