A-Level Edexcel Programming: Operators and Programming Structures | A-Level Edexcel 编程:运算符与程序结构

📚 A-Level Edexcel Programming: Operators and Programming Structures | A-Level Edexcel 编程:运算符与程序结构

Understanding operators and programming structures is essential for success in the Edexcel A-Level Computer Science Paper 2 and the non-exam assessment. This article covers arithmetic, comparison and Boolean operators, precedence rules, and the three core control structures: sequence, selection and iteration.

理解运算符和程序结构对于在 Edexcel A-Level 计算机科学 Paper 2 及课程作业中取得成功至关重要。本文涵盖算术、比较和布尔运算符、优先级规则,以及三种核心控制结构:顺序、选择和迭代。


1. Arithmetic Operators and Precedence | 算术运算符与优先级

In Edexcel pseudocode, arithmetic operators include + addition, subtraction, * multiplication, / division, DIV integer division, MOD remainder and ^ exponentiation. The result of DIV and MOD depends on whole-number operands.

在 Edexcel 伪代码中,算术运算符包括 + 加法、 减法、* 乘法、/ 除法、DIV 整除、MOD 取余和 ^ 幂运算。DIV 和 MOD 的结果取决于整数操作数。

Operators are evaluated in a strict order: brackets first, then ^, then * / DIV MOD, and finally + –. For example, 3 + 4 * 2 equals 11 because multiplication happens before addition.

运算符按严格顺序求值:先括号,然后 ^,接着 * / DIV MOD,最后 + –。例如,3 + 4 * 2 的结果是 11,因为乘法先于加法进行。

Expression Result
7 DIV 2 3
7 MOD 2 1
2 ^ 3 8
(2 + 3) * 4 20

2. Comparison Operators | 比较运算符

Comparison operators compare two values and return a Boolean result. Edexcel pseudocode uses = for equality, <> for not equal, > for greater than, < for less than, >= for greater than or equal to, and <= for less than or equal to.

比较运算符用于比较两个值并返回布尔结果。Edexcel 伪代码使用 = 表示等于,<> 表示不等于,> 表示大于,< 表示小于,>= 表示大于或等于,<= 表示小于或等于。

In Python the equivalents are ==, !=, >, <, >= and <=. Do not confuse the assignment operator <- in pseudocode with the equality sign =.

在 Python 中等价运算符是 ==!=><>=<=。不要将伪代码中的赋值运算符 <- 与等号 = 混淆。

5 > 3 → TRUE   |   4 = 4 → TRUE   |   2 <> 2 → FALSE


3. Boolean Operators | 布尔运算符

Boolean operators

Published by TutorHao | A-Level 编程 Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading