CSE02 · Logic & coding joy
Loop Carnival
The carnival needs a light pattern printed row by row. Nested loops draw it.
🎯 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.
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
- The Python Tutorial · Python
- Pyodide: Python in the browser · Pyodide
- Introduction to Algorithms (6.006) · MIT OpenCourseWare
Official sources, checked on 5 Nov 2026. Cloud services change often; check the official page before relying on a feature. All references