👑 Premium Sign in Sign up

CSE02 · Logic & coding joy

Loop Carnival

The carnival needs a light pattern printed row by row. Nested loops draw it.

📶 L100⏱ 25 min🧪 Live lab

🎯 You will learn to

  • Write for loops with range
  • Nest one loop inside another
  • Predict output before running

🧪 Live environment

Runs entirely in your browser: nothing is installed, no real cloud account is used and your code is never sent to our server.

Loading the lab…

✅ Steps & checkpoints

🗺️ Nested loops: rows × columns

The outer loop picks the row; the inner loop prints each light in that row; the row number decides how many lights.

Nested loops: rows × columnsThe outer loop picks the row; the inner loop prints each light in that row; the row number decides how many lights.Rows nOuter looprow = 1..nInner loopcol = 1..rowPrint *New linePatterneach roweach columnrow donenext rowPerson / clientComputeApp / UI

The 2D diagram shows the exact flow, ports and trust boundaries. The 3D scene is a concept view of the same parts; packets travel along the same arrows.

🤔 Think about it

If the outer loop runs n times and the inner loop runs i times, how many stars are printed?

🛡️ Safety & cost

Runs in your browser only. Your code never leaves this page.

🧹 Cleanup

Nothing to clean up: refresh the page to start again.

📚 Reference documents

Official sources, checked on 5 Nov 2026. Cloud services change often; check the official page before relying on a feature. All references