- Subhasish Mishra
Python 3 Tutorial for beginners in Hindi - Chapter 4(Python Operators)
अपडेट किया गया: 10 नव. 2020
Operators का उपयोग variable और values पर operation करने के लिए किया जाता है।
Operators are used to perform operations on variables and values.
Python में, operators निम्न प्रकार के होते हैं।
Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Identity operators
Membership operators
Bitwise operators
आइए एक-एक करके इन python operators के बारे में जानें।
Python Arithmetic Operators
Arithmetic operators का उपयोग आम mathematical operations को करने के लिए numeric values के साथ किया जाता है।
यह ऑपरेटर बाएं से दाएं काम करता है।

x = 5
y = 3
print(x + y) #8
print(x - y) #2
print(x * y) #15
print(x / y) #1.6666666666666667
print(x // y) #2
print(x % y) #1
print(x**y) #125
Python Assignment Operators
Assignment operators का उपयोग variable को value देने के लिए किया जाता है
यह ऑपरेटर दाएं से बाएं काम करता है।

x = 5
print(x) #5
...........................
x = 5
x += 3
print(x) #8
...........................
x = 5
x -= 3
print(x) #2
...........................
x = 5
x *= 3
print(x) #15
...........................
x = 5
x /= 3
print(x) #1.6666666666666667
...........................
x = 5
x %= 3
print(x) #2
...........................
x = 5
x //= 3
print(x) #1
...........................
x = 5
x //= 3
print(x) #1
...........................
x = 5
x **= 3
print(x) #125
...........................
x = 5
x &= 3
print(x) #1
...........................
x = 5
x |= 3
print(x) #7
...........................
x = 5
x ^= 3
print(x) #6
...........................
x = 5
x >>= 3
print(x) #0
...........................
x = 5
x <<= 3
print(x) #80
...........................
Python Comparison Operators
Comparison operator का उपयोग दो values की तुलना करने के लिए किया जाता है
यह ऑपरेटर हमेशा एक boolean value लौटाता है यानी "True" या "False"।
x = 5
y = 3
print(x == y) #Fase
print(x != y) #True
print(x > y) #True
print(x < y) #False
print(x >= y) #True
print(x <= y) #False
Python Logical Operators
Conditional statements को combine करने के लिए logical operators का उपयोग किया जाता है।
x = 5
print(x > 3 and x < 10) #True
print(x > 3 or x < 10) #True
print(not(x > 3 and x < 10)) #False
Python Identity Operators
Identity Operators का उपयोग objects की तुलना करने के लिए किया जाता है, न कि यदि वे समान हैं, लेकिन यदि वे वास्तव में एक ही object हैं, एक ही memory location के साथ .
x = ["apple", "banana"]
y = ["apple", "banana"]
z = x
print(x is z) # returns True because z is the same object as x
print(x is y) # returns False because x is not the same object as y,
even if they have the same content
print(x == y) # to demonstrate the difference between "is" and "==":
this comparison returns True because x is equal to y
print(x is not z) # returns False because z is the same object as x
print(x is not y) # returns True because x is not the same object as
y, even if they have the same content
print(x != y) # to demonstrate the difference between "is not"
and "!=": this comparison returns False because x
is equal to y
Python Membership Operators
Membership operator को यह परीक्षण करने के लिए उपयोग किया जाता है कि किया जाता है कि क्या कोई specific sequence किसी object में मौजूद है या नहीं।
x = ["apple", "banana"]
print("banana" in x) # returns True because a sequence with the
value "banana" is in the list
.........................
x = ["apple", "banana"]
print("pineapple" not in x) # returns True because a sequence with the
value "pineapple" is not in the list
Python Bitwise Operators
Bitwise operators का उपयोग binary numbers की तुलना करने के लिए किया जाता है।
इसलिए इस अध्याय में, हमने 7 operators के बारे में सीखा। मुझे आशा है कि आपको यह अच्छी तरह से समझ में आ गया होगा। यदि आपको कोई संदेह है, तो नीचे comment करें।
अगर आप chapter wise नोट्स चाहते हैं तो अपना email कमेंट बॉक्स में डालें।