Removed mapping in accuracy calculation in ex4.
Updated ex4 for Python 3.