## python基础-运算符

1、算数运算: +,-,*,/,%,**,//

```print (3+2) => 5
print (3-2) => 1
print (2*4) => 8
print (9/3) => 3
print (2**2) => 4
print (100%51) => 49
print (9//2) => 4```

2、比较运算: ==,!=,<>,>,<,>=,<=

```print (3==2) => False
print (3!=2) => True
print (2<>4) =>  True #python3.5中已经取消，整合至!=
print (9>3) => True
print (2<2) => False
print (100>=51) => True
print (9<=2) => False```

3、赋值运算: =,+=,-=,*=,/=,%=,**=,//=

```a = 5
print (a) => 5
a = 5
b = 1
b += a  # b=b+a
print (b) => 6
a = 5
b = 1
b -= a  # b=b-a
print (b) => -4
a = 5
b = 1
b *= a  # b= b*a
print (b) => 5
a = 5
b = 1
b /= a  # b = b/a
print (b) => 0.2
a = 5
b = 1
b **= a # b = b**a
print (b) => 1
a = 5
b = 1
b %= a # b = b%a
print (b) => 1
a = 5
b = 1
b //= a # b = b//a
print (b) => 0```

4、逻辑计算: and, or ,not

```a = True
b = False
print (a and b) => False # 只有a,b均为真时，才为真
print (a or b) => True # 只要a,b中有一个为真时，就为真
print (not a) => False # 非真
print (not b) => True # 非假```

5、成员运算: in, not in

```a = [11,22,33,44]
b = 11
c = 123

print (b in a)  =>True
print (c not in a)  => True```