Iteration (Edexcel GCSE Computer Science): Flashcards

📚Flashcards
Iteration 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

What is iteration?

Repeating the same set of actions multiple times to automate repetitive tasks

Key characteristic of iteration

You know in advance how many times to repeat

Most common way to create iteration in Python

for loops

Purpose of 'for' keyword in Python

Starts the loop

Purpose of 'in' keyword in for loops

Connects loop variable to data structure

Why is indentation crucial in Python loops?

Tells computer which commands belong inside the loop

What does range() function do?

Generates a sequence of numbers

Three parameters of range() function

Start, stop, step

Does range() include the stop number?

No, it stops before the stop number

What does range(5) generate?

0, 1, 2, 3, 4

What must every for loop line end with?

A colon

for...in loops work with:

Values directly from data structure

for...in range() loops use:

Index positions and counting

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

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