Nested for-loop math notation I'm new to writing math notation that describes algorithms and I need to translate some python code. Does the notation structure below correctly describe a nested for-loop that for-each value in p iterates over all other values in p?

Example code
function(p):
    for a in p:
       for b in p:
         // do something with a and b...
The $\sum$ notation is specifically summation. There is also product notation:
$$n! = \prod_{i=1}^{n} i $$
But I think what you want is some kind of Zermelo-Fraenkel notation?
$$\left\{ f(a,b)\,|\,a,b \in P \right\}$$