Nested loop
Në shqip: Cikël brenda ciklit
ShpjegimiSQ
Cikli i mbivendosur është një cikël brenda një cikli tjetër. Për çdo hap të ciklit të jashtëm, cikli i brendshëm kryhet i tëri — p.sh. për rreshtat dhe kolonat e një tabele.
EnglishEN
A nested loop is a loop inside another loop. For every step of the outer loop, the inner loop runs all the way through — for example, for the rows and columns of a table.
Si ta mendosh
Si tabela e shumëzimit që mësove në shkollë: çdo numër nga 1 te 10 (cikli i jashtëm) e shumëzon me secilin nga 1 te 10 (cikli i brendshëm).
Lexoje në anglisht
Like the times tables you learned at school: every number from 1 to 10 (outer loop) gets multiplied by each number from 1 to 10 (inner loop).
Shembull kodipython
for a in range(1, 4):
for b in range(1, 4):
print(a, "x", b, "=", a * b)