Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 第04课:Python语言元素之运算符.md #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 第04课:Python语言元素之运算符.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Python语言支持很多种运算符,我们先用一个表格为大家列出
| ------------------------------------------------------------ | ------------------------------ |
| `[]` `[:]` | 下标,切片 |
| `**` | 指数 |
| `~` `+` `-` | 按位取反, 正负号 |
| `~` `+` `-` | 按位取反, 正号,负号 |
| `*` `/` `%` `//` | 乘,除,模,整除 |
| `+` `-` | 加,减 |
| `>>` `<<` | 右移,左移 |
Expand Down Expand Up @@ -59,7 +59,7 @@ a *= a + 2 # 相当于:a = a * (a + 2)
print(a) # 算一下这里会输出什么
```

###比较运算符和逻辑运算符
### 比较运算符和逻辑运算符

比较运算符有的地方也称为关系运算符,包括`==`、`!=`、`<`、`>`、`<=`、`>=`,我相信没有什么好解释的,大家一看就能懂,需要提醒的是比较相等用的是`==`,请注意这里是两个等号,因为`=`是赋值运算符,我们在上面刚刚讲到过,`==`才是比较相等的运算符;比较不相等用的是`!=`,这不同于数学上的不等号,Python 2中曾经使用过`<>`来表示不等关系,大家知道就可以了。比较运算符会产生布尔值,要么是`True`要么是`False`。

Expand Down