mlclass-ex2: updated python code.