# Formulating a simple algebraic equation

$P_{i+1} = P_{i} + W_{i} (\lambda_{i}-P_{i})$
But I have a list of things $i...n$ so that I need to loop through n times. How can I write a mathematical expression for $P_{n}$ that is based on the entire list, not just $n-1$?