Python code for Numerical Methods