Python Operators Cheat Sheet
Python के सभी प्रमुख Operators की यह quick-reference sheet है। इसे सीखने, coding करते समय reference के रूप में इस्तेमाल करने और Stock Market Algo Trading के उदाहरणों को समझने के लिए बनाया गया है।
1. Comparison Operators
Operator | Meaning | Example | Result |
|---|---|---|---|
| Equal to |
|
|
| Not equal to |
|
|
| Greater than |
|
|
| Less than |
|
|
| Greater than or equal to |
|
|
| Less than or equal to |
|
|
2. Arithmetic Operators
Operator | Meaning | Example | Result |
|---|---|---|---|
| Addition |
|
|
| Subtraction |
|
|
| Multiplication |
|
|
| Division |
|
|
| Floor division |
|
|
| Remainder |
|
|
| Power |
|
|
3. Assignment Operators
Operator | Example | Equivalent |
|---|---|---|
|
| Value assign करना |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Bitwise AND assignment |
|
| Bitwise OR assignment |
|
| Bitwise XOR assignment |
|
| Left-shift assignment |
|
| Right-shift assignment |
4. Logical Operators
Operator | Meaning | Example | Result |
|---|---|---|---|
| दोनों conditions True |
|
|
| कम-से-कम एक True |
|
|
| Boolean उलटना |
|
|
5. Membership Operators
Operator | Meaning | Example | Result |
|---|---|---|---|
| मौजूद है |
|
|
| मौजूद नहीं है |
|
|
6. Identity Operators
Operator | Meaning | Example |
|---|---|---|
| दोनों एक ही Object हैं |
|
| दोनों अलग Objects हैं |
|
x = [1, 2]y = xz = [1, 2]print(x == z) # Trueprint(x is z) # Falseprint(x is y) # True== Values की तुलना करता है, जबकि is Object Identity की।
7. Bitwise Operators
Operator | Meaning | Example | Result |
|---|---|---|---|
| Bitwise AND |
|
|
| Bitwise OR |
|
|
| Bitwise XOR |
|
|
| Bitwise NOT |
|
|
| Left shift |
|
|
| Right shift |
|
|
8. Conditional Expression
price = 520target = 500signal = "Target Reached" if price >= target else "Target Not Reached"print(signal)Output: Target Reached
9. Algo Trading में Operators का उपयोग
current_price = 520target_price = 500volume = 150000if current_price >= target_price and volume > 100000: print("Conditions Met")else: print("Conditions Not Met")यहाँ >=, > और and मिलकर दो conditions जाँचते हैं।
याद रखने योग्य बातें
=→ Assignment==→ Equality comparison!=→ Not equal>=→ Greater than or equal to<=→ Less than or equal toand,or,not→ Logical operationsin,not in→ Membershipis,is not→ Object identity
BusinessTech360 Learning Path: Python Variables → Data Types → Operators → Conditions → Loops → Functions → Pandas → Backtesting.