Computer Science GCES EDEXCEL
-
Decomposition And Abstraction Edexcel2 主题
-
Algorithms Edexcel11 主题
-
Follow And Write Algorithms Edexcel
-
Introduction To Programming Concepts Edexcel
-
Basic Programming Concepts Edexcel
-
Variables Constants And Assignments Edexcel
-
Data Structures And Arrays Edexcel
-
Arithmetic Relational And Logical Operations Edexcel
-
Determine Outputs Of An Algorithm Edexcel
-
Types Of Errors Edexcel
-
Standard Sorting Algorithms Edexcel
-
Standard Searching Algorithms Edexcel
-
Algorithm Efficiency Edexcel
-
Follow And Write Algorithms Edexcel
-
Truth Tables Edexcel3 主题
-
Binary Edexcel6 主题
-
Data Representation Edexcel4 主题
-
Data Storage And Compression Edexcel2 主题
-
Hardware Edexcel5 主题
-
Software Edexcel3 主题
-
Programming Languages Edexcel2 主题
-
Networks Edexcel7 主题
-
Network Security Edexcel2 主题
-
Environmental Issues Edexcel1 主题
-
Ethical And Legal Issues Edexcel3 主题
-
Cybersecurity Edexcel2 主题
-
Develop Code Edexcel6 主题
-
Constructs Edexcel4 主题
-
Data Types And Data Structures Edexcel5 主题
-
Operators Edexcel1 主题
-
Subprograms Edexcel2 主题
Repetition And Iteration Edexcel
Exam code:1CP2
Repetition & Iteration
What is the difference between repetition and iteration?
-
Repetition is executing the same instructions whilst a condition is True
-
Iteration is is executing the same instructions until all items in a data structure have been processed
-
Repetition & iteration are both examples of loops
Repetition
|
Python examples |
|
|---|---|
|
|
The instructions inside the loop repeat until the A higher starting number would result in more repeating |
|
|
Whilst the user does not input a “Y” to accept the terms & conditions the question is repeated infinitely |
Iteration
|
Python examples |
|
|---|---|
|
|
Outputs the values of the scores array, multiplied by 2 on separate lines |
|
|
The for loop processes each student in the students table. In each loop the individual fields are outputted. The output from this loop is: Name: Bob Test score: 78 Name: Fred Test score: 24 Name: Julie Test score: 32 |
-
Repetition & iteration can be further confused with the addition of different types of loops
|
Type of loop |
Description |
|---|---|
|
Count-controlled |
The number of loops is already known or can be determined before the loop starts |
|
Condition-controlled |
The number of loops is not known, it continues until the condition is True |
|
Python example |
Repetition or iteration? |
Type of loop? |
|---|---|---|
|
|
Repetition |
Condition-controlled |
|
|
Repetition |
Count-controlled |
|
|
Iteration |
Count-controlled |
-
In Python, when the
range()function is used, the loop is count-controlled -
If the loop is used to access a data structure it is iteration
Examiner Tips and Tricks
If the word ‘iteration‘ is used in an instruction, you can use a ‘for‘ loop to process a data structure.
If the word ‘repetition is used in an instruction, you must choose whichever construct (‘for‘, ‘while‘) is suitable for the program
Responses