diff --git a/docs/arithmetic-operation.md b/docs/arithmetic-operation.md index 74c88a4..d8ac13a 100644 --- a/docs/arithmetic-operation.md +++ b/docs/arithmetic-operation.md @@ -64,8 +64,8 @@ num1 = 10 num2 = 5 # 1. Addition -sum = num1 + num2 -print("Sum:", sum) +sum_val = num1 + num2 +print("Sum:", sum_val) # 2. Subtraction difference = num1 - num2 @@ -98,6 +98,7 @@ print("Updated num2 after decrement:", num2) ### Code Highlight - The syntax for addition, subtraction, multiplication, division, remainder, and exponentiation in Python is the same as in JavaScript. +- sum is the [Built-in Function](https://docs.python.org/3/library/functions.html?highlight=sum#sum) in Python, it is important to avoid using it. - Python does not have the `++` and `--` operators. Instead, `+=` and `-=` are used to increment or decrement variables. ### Difference Quick View diff --git a/i18n/zh-cn/docusaurus-plugin-content-docs/current/arithmetic-operation.md b/i18n/zh-cn/docusaurus-plugin-content-docs/current/arithmetic-operation.md index 47c775d..1cc6ada 100755 --- a/i18n/zh-cn/docusaurus-plugin-content-docs/current/arithmetic-operation.md +++ b/i18n/zh-cn/docusaurus-plugin-content-docs/current/arithmetic-operation.md @@ -64,8 +64,8 @@ num1 = 10 num2 = 5 # 1. 相加 -sum = num1 + num2 -print("和:", sum) +sum_val = num1 + num2 +print("和:", sum_val) # 2. 相减 difference = num1 - num2 @@ -98,6 +98,7 @@ print("自减后的 num2:", num2) ### 代码解读 - Python 的加、减、乘、除、取余、指数运算语法与 JavaScript 一致。 +- sum 在Python中是 [内置函数](https://docs.python.org/3/library/functions.html?highlight=sum#sum),在编写代码时应避免使用。 - Python 中没有 `++` 和 `--` 运算符,需要使用 `+=` 和 `-=` 对变量进行自增或自减。 ### 差异速览