Glossary
Iteration
The process of repeating a set of instructions or a block of code. Each pass through the loop, where the code block is executed once, is considered a single iteration.
Example:
When a program counts from 1 to 10, each number printed represents a single iteration of the counting process.
Loops (Iterative Statements)
Programming constructs that allow a block of code to be executed multiple times, either a specific number of times or until a certain condition is met. They are fundamental for automating repetitive tasks in programs.
Example:
A game might use a loop to continuously check for player input, allowing the game to run until the player quits.
Pseudocode
An informal, high-level description of an algorithm or program logic, intended for human reading rather than machine execution. It combines natural language with programming-like constructs to outline steps.
Example:
Before writing actual code for a game, a designer might use pseudocode like IF player_health <= 0 THEN display 'Game Over' to plan the game's logic.
Repeat n Times Loop
A type of loop that executes a block of code a predetermined, fixed number of times. The 'n' specifies the exact count of repetitions that will occur.
Example:
To draw a square using a turtle graphics program, you could use a repeat n times loop to draw a side and turn 90 degrees exactly four times.
for... in range loop
A specific Python programming construct used to create a loop that iterates a fixed number of times. It is commonly used to generate a sequence of numbers or iterate over elements in a collection.
Example:
To print numbers from 0 to 4, you would use a for... in range loop like for i in range(5): print(i).
