- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4_operators_in_python.py
More file actions
Latest commit
51 lines (43 loc) · 1 KB
/
Copy path4_operators_in_python.py
File metadata and controls
51 lines (43 loc) · 1 KB
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
#Arithmatic operator
'''
+ Addition 5 + 3 → 8
- Subtraction 5 - 3 → 2
* Multiplication 5 * 3 → 15
/ Division 5 / 2 → 2.5
// Floor Division 5 // 2 → 2
% Modulus (remainder) 5 % 2 → 1
** Exponentiation 2 ** 3 → 8 '''
#Relational Operaror
'''
== Equal to 5 == 5 → True
!= Not equal to 5 != 3 → True
> Greater than 5 > 3 → True
< Less than 5 < 3 → False
>= Greater than or equal to 5 >= 3 → True
<= Less than or equal to 5 <= 3 → False'''
#Logical operator
'''
and
or
not '''
#Bitwise operator
'''
& AND 5 & 3 → 1
` ` OR
^ XOR 5 ^ 3 → 6
~ NOT ~5 → -6
<< Left shift 5 << 1 → 10
>> Right shift 5 >> 1 → 2'''
#membership operators
'''
1) in
2) not in
'''
fruits= ["apple", "banana", "cherry"]
print("apple"infruits) # True
print("grape"notinfruits) # True
#identify Operator
'''
1) is
2) is not
'''