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 主题
Sequence And Selection Edexcel
Exam code:1CP2
Sequence
What is sequence?
-
Sequence is a set of instructions executed one after another
|
Python example |
|---|
|
“”” This function calculates the area of a rectangle Inputs: length: The length of the rectangle width: The width of the rectangle Returns: The area of the rectangle “”” # Calculate area
# ————————————————————————# Main program # ————————————————————————
|
-
In the example, the sequence of instructions is wrong and would cause a runtime error (opens in a new tab)
-
In the
calculate_area()function a value is returned before it is assigned -
The correct sequence is:
# Calculate areaarea = length * widthreturn area
Selection
What is selection?
-
Selection is a programming construct that allows a program to execute in different ways based on the outcome of a condition
-
Selection is implemented using the
iffunction -
Nested selection can be used, the use of ‘
else‘ and ‘elif‘ is preferable for efficiency and to make logic clearer
|
Python examples |
|---|
|
|
|
|
|
Nested selection
|
Responses