Arithmetic Operators in Python in Hindi – Arithmetic Operators Kya Hai?
Table of Contents
1. Introduction to Arithmetic Operators in Hindi – Arithmetic Operators Kya Hai?
3. Difference Between / (Division) and // (Floor Division) in Python in Hindi
Introduction to Arithmetic Operators in Hindi – Arithmetic Operators Kya Hai?
पहले हमने Expressions के बारे में पढ़ा था, और उन Expressions को बनाने में सबसे ज्यादा इस्तेमाल होने वाले operators होते हैं Arithmetic Operators, इसलिए exam की नज़र से यह एक बहुत basic लेकिन बेहद important topic है।
Simple भाषा में कहें तो Arithmetic Operators वह symbols होते हैं जिनका इस्तेमाल दो या दो से ज्यादा numbers के बीच mathematical calculations (जैसे जोड़, घटाव, गुणा, भाग) करने के लिए किया जाता है।
जैसे स्कूल में हम calculator पर +, -, ×, ÷ जैसे buttons इस्तेमाल करते थे, ठीक उसी तरह Python में भी इन्हीं operations को perform करने के लिए कुछ खास symbols (operators) दिए गए हैं।
हर arithmetic operator को दो values (जिन्हें operands कहा जाता है) के बीच लिखा जाता है, जैसे
a + bमें a और b operands हैं, और+arithmetic operator है।Python में कुल 7 मुख्य Arithmetic Operators होते हैं, और इनमें से हर एक का इस्तेमाल अलग-अलग तरह की calculations के लिए किया जाता है, जिन्हें आगे विस्तार से समझाया गया है।
यह operators सिर्फ integers (whole numbers) पर ही नहीं, बल्कि floats (decimal numbers) पर भी equally अच्छी तरह काम करते हैं, यानी
5 + 2भी valid है और5.5 + 2.3भी।Exam की नज़र से देखा जाए तो Arithmetic Operators का मतलब है – "wo symbols jinka use numbers ke beech mathematical operations perform karne ke liye kiya jata hai, jaise addition, subtraction, multiplication aur division."
Types of Arithmetic Operators in Hindi – Addition, Subtraction, Multiplication, Division, Floor Division, Modulus, Exponentiation
-
1. Addition Operator (+):
इसका इस्तेमाल दो numbers को आपस में जोड़ने के लिए किया जाता है, यह strings को जोड़ने (concatenation) के लिए भी इस्तेमाल होता है।a = 8 b = 5 print(a + b) # Output: 13 -
2. Subtraction Operator (-):
इसका इस्तेमाल एक number में से दूसरे number को घटाने के लिए किया जाता है।a = 8 b = 5 print(a - b) # Output: 3 -
3. Multiplication Operator (*):
इसका इस्तेमाल दो numbers को आपस में गुणा करने के लिए किया जाता है, इसे किसी string को कई बार repeat करने के लिए भी इस्तेमाल किया जाता है।a = 8 b = 5 print(a * b) # Output: 40 -
4. Division Operator (/):
इसका इस्तेमाल एक number को दूसरे number से भाग देने के लिए किया जाता है, इसका result हमेशा एक float (decimal) value में आता है, चाहे division पूरी-पूरी क्यों न हो।a = 8 b = 5 print(a / b) # Output: 1.6 -
5. Floor Division Operator (//):
यह भी division ही करता है, लेकिन result में जो decimal (point के बाद वाला) हिस्सा आता है उसे हटाकर, सिर्फ उससे छोटा या बराबर पूरा number (integer) return करता है।a = 8 b = 5 print(a // b) # Output: 1 -
6. Modulus Operator (%):
इसका इस्तेमाल division के बाद बचा हुआ remainder (शेषफल) निकालने के लिए किया जाता है, यह operator किसी number के even/odd होने की जांच करने में सबसे ज्यादा इस्तेमाल होता है।a = 8 b = 5 print(a % b) # Output: 3 -
7. Exponentiation Operator (**):
इसका इस्तेमाल किसी number की power (घात) निकालने के लिए किया जाता है, यानी एक number को दूसरे number जितनी बार खुद से गुणा करना।a = 5 b = 2 print(a ** b) # Output: 25 (5 ka square)
Sabhi Operators Ek Saath (Quick Summary Table):
| Operator | Naam | Example (a=8, b=5) | Result |
|---|---|---|---|
| + | Addition | a + b | 13 |
| - | Subtraction | a - b | 3 |
| * | Multiplication | a * b | 40 |
| / | Division | a / b | 1.6 |
| // | Floor Division | a // b | 1 |
| % | Modulus | a % b | 3 |
| ** | Exponentiation | a ** b | 32768 |
Difference Between / (Division) and // (Floor Division) in Python in Hindi
Exam में सबसे ज्यादा confuse करने वाला topic यही होता है – Division (/) और Floor Division (//) में फर्क, इसलिए इसे बहुत ध्यान से समझना जरूरी है।
Division (/): यह operator हमेशा एक accurate (सटीक) result देता है, जिसमें decimal (point के बाद की values) भी शामिल होती हैं, भले ही division बिना किसी remainder के पूरी हो रही हो।
Floor Division (//): यह operator division तो करता है, लेकिन result के decimal हिस्से को हटाकर सिर्फ उससे छोटा या बराबर सबसे बड़ा integer (Floor Value) return करता है।
print(10 / 3) # Output: 3.3333333333333335 (accurate decimal value)
print(10 // 3) # Output: 3 (sirf floor value)
print(9 / 3) # Output: 3.0 (yahan bhi decimal point ke saath, kyunki / hamesha float deta hai)
print(9 // 3) # Output: 3 (poori tarah divide hone par bhi sirf integer)
Negative Numbers ke Saath Special Behaviour:
Floor Division negative numbers के साथ थोड़ा अलग behave करता है, क्योंकि यह हमेशा result को नीचे की तरफ (Number Line पर left की तरफ) round करता है, ऊपर की तरफ नहीं।
print(-7 / 2) # Output: -3.5
print(-7 // 2) # Output: -4 (kyunki -3.5 se chhota integer -4 hai, na ki -3)
Quick Comparison Table:
| Point | / (Division) | // (Floor Division) |
|---|---|---|
| Result Type | Hamesha float | Integer (agar dono operands integer hon) |
| Decimal Part | Poora decimal part rakhta hai | Decimal part hata deta hai |
| Example | 10 / 3 = 3.333... | 10 // 3 = 3 |
| Negative Numbers | Accurate decimal deta hai (-3.5) | Neeche ki taraf round karta hai (-4) |
| Use Case | Jab exact/precise result chahiye | Jab sirf poore (whole) parts chahiye ho |
Exam में याद रखने का सबसे आसान तरीका यह है – Division (/) हमेशा "पूरा सच" बताता है (decimal सहित), जबकि Floor Division (//) सिर्फ "पूरे हिस्से" (whole part) तक ही रुक जाता है, और negative numbers में यह हमेशा नीचे (छोटी value) की तरफ round करता है, ऊपर की तरफ नहीं।
Frequently Asked Questions (FAQ) – Arithmetic Operators in Python in Hindi
Python में कुल 7 मुख्य Arithmetic Operators होते हैं – Addition (+), Subtraction (-), Multiplication (*), Division (/), Floor Division (//), Modulus (%) और Exponentiation (**)।
Division (/) हमेशा decimal सहित accurate result देता है, जबकि Floor Division (//) decimal हिस्से को हटाकर सिर्फ उससे छोटा या बराबर पूरा integer return करता है।
Modulus Operator (%) का सबसे common इस्तेमाल यह check करने के लिए होता है कि कोई number Even है या Odd, यानी जब number % 2 का result 0 आता है तो number Even होता है।
Negative numbers पर Floor Division हमेशा result को Number Line पर नीचे (छोटी value) की तरफ round करता है, जैसे -7 // 2 का result -4 आता है, न कि -3।
Exponentiation Operator (**) का इस्तेमाल किसी number की power (घात) निकालने के लिए किया जाता है, जैसे 5 ** 2 का result 25 आता है, यानी 5 का square।