Simplified accuracy calculation in ex3 and ex3_nn.
Python 3 compatibility in ex3.