Python code for the post on linear regression