Two Pointer Algorithm Python Code Generator