Repetition (Edexcel GCSE Computer Science): Flashcards

📚Flashcards
Repetition in programming
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

13 cards from this deck

Show

Repetition in programming

Running the same code multiple times

Two main types of repetition

Condition-controlled and count-controlled

Condition-controlled repetition

Code repeats while a condition remains true

Count-controlled repetition

Code repeats for a specific, fixed number of times

While loop behavior

Executes as long as the specified condition is true

Basic while loop syntax in Python

while <condition>: <command>

For loop purpose

Repeats code for a known, specific number of times

Basic for loop syntax in Python

for <id> in range(<start>, <stop>, <step>): <command>

range() function purpose

Generates a sequence of numbers for loops

range(0, 10) output behavior

Gives numbers 0-9, stops before 10

When to use while loops

When you don't know how many times to repeat

When to use for loops

When you know exactly how many repetitions needed

Boolean operators for compound conditions

and, or, not

Join 100,000+ GCSE students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.