📚 Mastering Operators and Expressions in Edexcel A-Level Programming | 精通 Edexcel A-Level 编程中的运算符与表达式
Every Edexcel A-Level programming question eventually comes down to evaluating expressions: predicting what a line of code does, writing a condition for an if statement, or tracing a loop until a variable changes. This revision guide focuses on operators and expressions, using Python-style syntax alongside the Edexcel pseudocode conventions you are likely to meet in Paper 2.
每一道 Edexcel A-Level 编程题最终都会回到表达式求值:预测某行代码的运行结果、为 if 语句写出条件,或者追踪循环直到变量发生变化。本复习指南聚焦运算符与表达式,使用 Python 风格语法,并结合你在 Paper 2 中可能遇到的 Edexcel 伪代码规范。
1. Operators and Expressions: Core Concepts | 运算符与表达式:核心概念
An operator is a symbol that tells the computer to perform a specific operation on one or more operands. An expression is any valid combination of values, variables, operators and function calls that can be evaluated to produce a single value.
运算符是告诉计算机对一个或多个操作数执行特定操作的符号。表达式是值、变量、运算符和函数调用的任意合法组合,能够被求值并产生一个单一的值。
For example, in total = price * quantity + 10, the expression price * quantity + 10 is evaluated first and then assigned to the variable total. This distinction between expression evaluation and assignment is important in trace tables and written answers.
例如,在 total = price * quantity + 10 中,先计算表达式 price * quantity + 10,再把结果赋给变量 total。表达式求值与赋值之间的区别在跟踪表和书面答案中十分重要。
expression → evaluated to a single value → assigned or used in a statement
表达式 → 求值为单一值 → 赋给变量或用于语句
2. Arithmetic Operators | 算术运算符
The arithmetic operators perform basic mathematical calculations. Edexcel questions often expect you to know both the exact division operator and the integer-division operator, because they behave differently in Python and in pseudocode.
算术运算符执行基本数学计算。Edexcel 题目经常要求你同时掌握精确除法运算符和整数除法运算符,因为它们在 Python 和伪代码中的行为不同。
Key arithmetic operators are summarised below. The result column assumes a = 7 and
Published by TutorHao | A-Level 编程 Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导