Two Pointer Algorithm Python If Statements