aa = [3, 5] ; bb = [4, 6] ; li = []
for a in range(aa[0], aa[1]):
for b in range(bb[0], bb[1]):
if b <= a:
continue
else:
for c in range(aa[0], aa[1]):
for d in range(bb[0], bb[1]):
if d <= c:
continue
else:
print([a, b, c, d])
li += [[a, b, c, d]]
print('迴圈執行總數:', len(li))
[3, 4, 3, 4] [3, 4, 3, 5] [3, 4, 4, 5] [3, 5, 3, 4] [3, 5, 3, 5] [3, 5, 4, 5] [4, 5, 3, 4] [4, 5, 3, 5] [4, 5, 4, 5] 迴圈執行總數: 9
以上要如何在迴圈執行前,就計算出迴圈的執行總數?