Test yourself on Iteration (Loops) with exam style questions, marked instantly.
Flashcards that come back just before you would forget them.
A revision plan that remembers what you know and shows what to do next.
See which topics you have nailed and which need another look.
Quiz yourself on Iteration (Loops)Get your flashcardsBuild my revision planTrack my progressPractical Examples (GCSE Pseudocode & Python)
Example 1: Sum Numbers 1 to 100
GCSE Pseudocode:
total = 0
for i = 1 to 100
total = total + i
next i
OUTPUT "Sum: " + total
// Output: Sum: 5050
Python Equivalent:
total = 0
for i in range(1, 101):
total = total + i
print("Sum:", total)
# Output: Sum: 5050
Example 2: Guessing Game
secretNumber = 42
guess = 0
attempts = 0
while guess != secretNumber
INPUT guess
attempts = attempts + 1
if guess < secretNumber then
OUTPUT "Too low!"
elseif guess > secretNumber then
OUTPUT "Too high!"
endif
endwhile
OUTPUT "Correct! You took " + attempts + " attempts"
Example 3: Input Validation with DO UNTIL (OCR style)
do
INPUT age
until age >= 0 AND age <= 120
OUTPUT "Valid age entered: " + ageMake this stick
Signing in gives access to all PrepWise features.