- 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.
推薦閱讀
- Mastering Zabbix(Second Edition)
- Instant Typeahead.js
- Learn React with TypeScript 3
- Python忍者秘籍
- Getting Started with Hazelcast(Second Edition)
- JavaScript程序設計(第2版)
- Spring Boot+MVC實戰指南
- IoT Projects with Bluetooth Low Energy
- Python+Office:輕松實現Python辦公自動化
- Visual Basic 程序設計實踐教程
- 軟件測試分析與實踐
- JBoss AS 7 Development
- Android開發進階實戰:拓展與提升
- Android項目實戰:博學谷
- Serverless工程實踐:從入門到進階