डाउनलोड पी.डी.एफ. ई-बुक्स
Python - Membership Operators

Membership Operators

Membership OperatorDescription
inअगर collection(list, tuple, dictionary, string, set) में element या value मिली तो True return करता है |
not inअगर collection(list, tuple, dictionary, string, set) में element या value नहीं मिली तो True return करता है |

 

'in' Membership Operator

Source Code :
a = "Hello World"
print("ll" in a)

list = [1, "o", 8, 5]
print(1 in list)
Output :
True
True


'not in' Membership Operator

Source Code :
a = "Hello World"
print("lol" not in a)

list = [1, "o", 8, 5]
print(3 not in list)
Output :
True
True