Normally, inner loops are executed more times than outer loops, but in this program the inner loops are skipped (because of the continue statements) when constraints fail in the the outer loops. The five loops are executed a total of 69, 1265, 520, 890 and 109 times respectively (I put counter in each loop, all counters were initialized before any of the loops begin).
Python is great for simple problems like this. I wrote this program while waiting for my daughter to come downstairs to be driven to school this morning.