-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperator.py
53 lines (36 loc) · 1.18 KB
/
operator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
__________Precedence and Associativity
<!-- Precedence---------------------------------------
4+5*2 = 14
(4+5)*2 = 18
<!-- Associativity--------------------------------------
2+5-1 = 6 > left to right
2**3**2 = 512 > right to left
___________Operands:
4+4 is binary operator
-4 is unary operator
___________Operators
- Arithmetic Operator
- Relational Operator
- Membership Operator
- Boolean Operator
## Arithmetic Operator
- Negation
- Addition
- Subtraction
- Multiplication
- Division <!-- 5/4 = 1.25
- Tracating Division <!-- 5//4=1
## Relational Operator
- equal ==
- not equal !=
- less than <
- greater than >
- less than or equal to <=
- greater than or equal to >=
## Membership Operator
- in <!-- 5 in [1,2,3,4,5,6] = True
- not in <-- 5 not in [4,5,6,7,8] = False
## Boolean Operator
- and
- or
- not