<jupyter_start><jupyter_text>Python* High level, interpreter-based, general-purpose programming language* Introducted by **<NAME>** * Easily readible* Widely used programming language  Why to learn Python?* High-level, general-purpose programming language* One of mostly used programming language* Python prgramming language is close to human language* Wide application including but not limited to **Data Science, Machine Learning, Web-Development**,etc. * Open-Source* Rich libraries* Easy to use  Operators* **Arithmetic Operators**    * **Addition**: +    * **Subtraction**: -    * **Multiplication**: *    * **Division**: /    * **Division(floor)**: //    * **Modulus**: %    * **Exponential**: **<jupyter_code>print(1+2)<jupyter_output>3<jupyter_text>📌**Note**: If it is required to print only a last line in a **code cell** of Jupyter notebook, their is no necessaity of using **print()** function<jupyter_code>3-2
3*4
3/2<jupyter_output><empty_output><jupyter_text>* '' symbol is used to indicate the single comment line* '''comment''' is used to indicate the multiple comment line<jupyter_code>5//2 #Floor-Division 
5%2
5**2<jupyter_output><empty_output><jupyter_text>* **Relational Operators**    * **Equal to**: ==    * **Less than**: <    * **Greater than**: >    * **Not equal to**: !=    * **Greater than or equal to**: >=    * **Less than or equal to**: <=<jupyter_code>a = 10
b = 4
print(a == b)
print(a != b)
a < b
a > b
a != b
a >= b
a <= b<jupyter_output><empty_output><jupyter_text>* **Logical Operators**    * **and**: It returns true if both conditions are true    * **or**: It returns true if any condition is true     * **not**: It returns true if the condition is false or vice-versa<jupyter_code>4 > 2 and 5 < 6
4 < 2 and 5 < 6
66 < 66 or 66 < 67
66 < 64 or 66 < 61
66 <= 66 or 66 >= 67
not(66 > 63)
not(66 < 63)
not(66 >= 63)<jupyter_output><empty_output><jupyter_text>* **Bitwise Operators**: Perform operation bit by bit     * **AND**: &    * **OR**: |    * **XOR**: ^    * **NOT**: ~    * **Left shift**: <<    * **Right shift**: >> 📌**Note**: Please refer truth table to perform bitwise operation<jupyter_code># 2 : 0010
# 5 : 0101
# 2&5: 0000

2&5
# 2 | 5 : 0111

2 | 5
# 2 ^ 5 : 0111

2 ^ 5
# Bitwise NOT
~2
a = 2
a.__invert__()
~a == a.__invert__()
# 2 : 0010(2) 1000(8)

a = 2
a << 2
# 2 : 0010(2) 0000(2)

a >> 2<jupyter_output><empty_output><jupyter_text>* **Assignment Operators**    * =    * +=    * -=    * *=    * /=    * //=    * %=    * **=    * &=    * |=    * ^=    * >=<jupyter_code>a = 2 
b = 3 
print(a,b)
temp = 10
temp += a  #It is equivalent to temp = temp + a
print(temp)
temp = 10
temp -= a  #It is equivalent to temp = temp - a
print(temp)
temp = 10
temp *= a  #It is equivalent to temp = temp * a
print(temp)
temp = 10
temp /= a  #It is equivalent to temp = temp / a 
print(temp)
temp = 10
temp //= a  #It is equivalent to temp = temp // a (Floor division)
print(temp)
temp = 10
temp %= a  #It is equivalent to temp = 10 % 2 
print(temp)
temp = 10
temp **= a  #It is equivalent to temp = temp ** a 
print(temp)
temp = 2
temp &= 5   # 2 & 5 = 0
temp
temp = 2
temp |= 5   # 2 | 5 = 7
temp
temp = 2
temp ^= 5   # 2 ^ 5 = 7
# 2 0010
# 5 0101
#   0111
temp
temp = 2
temp >>=2   # >>2 = 0
temp
temp = 2
temp <<= 2   # <<2 = 8
temp
# Chain assignment
a = b = c = d = 3
print(a)
print(b)
print(c)
print(d)
a = b = c = d = 3
c = 2  #No alaising wow!
print(a)
print(b)
print(c)
print(d)
a <= b+1 >= c   # equivalent of (a <= b) and (b >= c) without performing b+1 twice<jupyter_output><empty_output><jupyter_text>* **Identity Operators**    * **is**: It returns true if the object is same    * **is not**: It returns true if the object is not same<jupyter_code>a = 2
b = 10

a is b
a is not b
1 is not 2
2 is 2<jupyter_output><empty_output><jupyter_text>* **Membership Operators**    * **in**: It returns true if the value resides in    * **not in**: It returns true if the value does not reside in<jupyter_code>lis = [1,2,3,4,5]
1 in lis
3 in lis
7 not in lis
7 in lis
'a' not in lis<jupyter_output><empty_output><jupyter_text>* **Unary Operators**    * +prog    * -prog    * ~prog<jupyter_code>a = 5
print(+a)
print(-a)
print(~a)<jupyter_output>5
-5
-6
{'fraction_non_alphanumeric': 0.16289592760180996, 'fraction_numerical': 0.048582995951417005, 'mean_word_length': 3.5258620689655173, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '273899', 'license': 'MIT', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1557, 'n_words': 542, 'path': '01 - Basics/01-Python_Operators.ipynb', 'repo_name': 'yesdeepakmittal/PY_training', 'size': '4209'}