Attempt at the pi method in python