Online Computer Courses Classes and Training Program

Python Operators in Hindi | Complete Guide with Examples Part 5

Python Operators in Hindi



Python Operators in Hindi | Arithmetic, Assignment, Comparison, Logical, Membership, Identity और Bitwise Operators | Complete Python Tutorial Part 5


Introduction

Programming में केवल Variables बनाना ही पर्याप्त नहीं होता।

असल Programming तब शुरू होती है जब हम उन Variables पर कोई Operation करते हैं।

जैसे—

  • जोड़ना

  • घटाना

  • तुलना करना

  • Condition Check करना

  • True या False निकालना

  • Decision लेना

इन सभी कार्यों के लिए Python में Operators का उपयोग किया जाता है।

इस अध्याय में हम Python के सभी महत्वपूर्ण Operators को विस्तार से समझेंगे।


Operator क्या होता है?

Operator एक विशेष Symbol होता है जो दो या अधिक Values पर कोई Operation करता है।

उदाहरण

10 + 5

यहाँ

10

और

5

Operands हैं।

जबकि

+

Operator है।


Python में Operators के प्रकार

Python में मुख्य रूप से सात प्रकार के Operators होते हैं।

  1. Arithmetic Operators

  2. Assignment Operators

  3. Comparison Operators

  4. Logical Operators

  5. Membership Operators

  6. Identity Operators

  7. Bitwise Operators

अब इन्हें एक-एक करके समझते हैं।


1. Arithmetic Operators

Arithmetic Operators गणितीय कार्य करने के लिए उपयोग किए जाते हैं।

मान लीजिए—

a = 20

b = 5

Addition (+)

print(a+b)

Output

25

Subtraction (-)

print(a-b)

Output

15

Multiplication (*)

print(a*b)

Output

100

Division (/)

print(a/b)

Output

4.0

ध्यान दें—

Division हमेशा Float Return करता है।


Floor Division (//)

print(a//b)

Output

4

Modulus (%)

बाकी (Remainder) निकालता है।

print(22%5)

Output

2

Exponent (**)

Power निकालने के लिए।

print(2**4)

Output

16

Practical Program

a = 50

b = 15

print("Addition =",a+b)

print("Subtraction =",a-b)

print("Multiplication =",a*b)

print("Division =",a/b)

print("Modulus =",a%b)

2. Assignment Operators

Variable में Value Store करने के लिए।


=

x = 10

+=

x = 10

x += 5

print(x)

Output

15

-=

x = 20

x -= 8

print(x)

Output

12

*=

x = 10

x *= 3

print(x)

Output

30

/=

x = 20

x /= 4

print(x)

Output

5.0

3. Comparison Operators

दो Values की तुलना करते हैं।

Result हमेशा

True

या

False

होता है।


==

print(10==10)

Output

True

!=

print(10!=20)

Output

True

>

print(50>20)

Output

True

<

print(10<5)

Output

False

>=

print(20>=20)

Output

True

<=

print(10<=5)

Output

False

4. Logical Operators

Logical Operators कई Conditions को जोड़ते हैं।


and

दोनों Condition True होनी चाहिए।

print(True and True)

Output

True

print(True and False)

Output

False

or

एक भी Condition True है तो Result True होगा।

print(True or False)

Output

True

not

Result उल्टा कर देता है।

print(not True)

Output

False

Practical Example

age = 20

print(age>=18 and age<=60)

Output

True

5. Membership Operators

किसी Collection के अंदर Value मौजूद है या नहीं।


in

name="Ajay"

print("A" in name)

Output

True

not in

print("Z" not in name)

Output

True

6. Identity Operators

दो Variables एक ही Object को Refer कर रहे हैं या नहीं।


is

a=[10]

b=a

print(a is b)

Output

True

is not

a=[10]

b=[10]

print(a is not b)

Output

True

7. Bitwise Operators

Bit Level पर Operation करते हैं।

मुख्य Bitwise Operators

&

|

^

~

<<

>>

उदाहरण

print(5 & 3)

Output

1

print(5 | 3)

Output

7

print(5 ^ 3)

Output

6

Real Life Example

यदि Student के Marks 33 से अधिक हैं

तो

Comparison Operator उपयोग होगा।

यदि

Student उपस्थित भी हो

और

Fees भी जमा हो

तभी Exam दे सके।

तो

Logical Operator उपयोग होगा।


Common Mistakes

print(10=20)

गलत


print(10==20)

if age=18

गलत


if age==18

Practice Programs

Program 1

दो Numbers जोड़िए।


Program 2

दो Numbers में बड़ा Number खोजिए।


Program 3

Even/Odd Check कीजिए।


Program 4

Student Pass या Fail निकालिए।


Program 5

Voting Eligibility Program बनाइए।


Program 6

Calculator Program

(+ − × ÷)


Program 7

Bitwise Operators का Output निकालिए।


Interview Questions

  • Operator क्या होता है?

  • Arithmetic Operator क्या है?

  • Assignment Operator क्या है?

  • == और = में क्या अंतर है?

  • Logical Operators कितने होते हैं?

  • Identity Operator क्या है?

  • Membership Operator कहाँ उपयोग होता है?

  • Bitwise Operators किस Level पर कार्य करते हैं?


Chapter Summary

इस अध्याय में आपने सीखा—

✅ Arithmetic Operators

✅ Assignment Operators

✅ Comparison Operators

✅ Logical Operators

✅ Membership Operators

✅ Identity Operators

✅ Bitwise Operators

✅ Practical Programs

✅ Interview Questions

अब आप Python में किसी भी प्रकार की Calculation, Decision Making और Condition Checking आसानी से कर सकते हैं। यही Operators आगे If-Else, Loops और Functions जैसे अध्यायों की मजबूत नींव बनाते हैं।


अगले अध्याय में क्या सीखेंगे?

Part 6 – Python Conditional Statements (if, if-else, if-elif-else, Nested if) और Decision Making Programs को आसान उदाहरणों के साथ विस्तार से समझेंगे।


Post a Comment

0 Comments