- Learn Python in 7 Days
- Mohit Bhaskar N. Das
- 122字
- 2021-07-09 20:40:25
Arithmetic expressions
Arithmetic expressions in any language comprise operands and operators. For reference, x and y are used as operands having values 10 and 20, respectively. The following table shows the precedence order:

In an arithmetic expression, generally, the rule of Bracket, Of, Division, Multiplication, Addition, and Subtraction (BODMAS) is followed, and operators have their own precedence order. Exponentiation enjoys a higher precedence order, while addition and subtraction have a lower precedence order.
The decreasing precedence order is as follows:
- Exponent
- Unary negation
- Multiplication, division, modulus
- Addition, subtraction
If operands are of the same data type, then the resulting value is also of that type. However, addition of two int data types can produce a long integer.
推薦閱讀
- 軟件項(xiàng)目估算
- Designing Machine Learning Systems with Python
- Python自然語(yǔ)言處理實(shí)戰(zhàn):核心技術(shù)與算法
- Delphi程序設(shè)計(jì)基礎(chǔ):教程、實(shí)驗(yàn)、習(xí)題
- 數(shù)據(jù)結(jié)構(gòu)與算法JavaScript描述
- Python高效開(kāi)發(fā)實(shí)戰(zhàn):Django、Tornado、Flask、Twisted(第2版)
- Eclipse Plug-in Development:Beginner's Guide(Second Edition)
- SharePoint Development with the SharePoint Framework
- Visual C#通用范例開(kāi)發(fā)金典
- Learning OpenStack Networking(Neutron)
- Python機(jī)器學(xué)習(xí):預(yù)測(cè)分析核心算法
- Essential C++(中文版)
- Unity Character Animation with Mecanim
- Python數(shù)據(jù)可視化之美:專業(yè)圖表繪制指南(全彩)
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)(第二版)