in keyword ka use hota hai check krne ke liye ki vo value sequence (list , string ,range) mai present hai ki nhi. Aayiye ise example ki madad se aur clear banate hai..
example:
----------------------------------------------------------------------------------------------------------
l = [1,2,3,4,5]
if 45 in l:
print("ha")
else:
print("na")
output:
na
#basically hm check kr rhe hai ki l naam ki list mai 45 present hai ki nhi agar present hai to
ha print ho agar present nhi hai to na print ho.
----------------------------------------------------------------------------------------------
not in keyowrd
example:
-----------------------------------------------------------------------------
k = [6,7,8,9,]
if 10 not in k:
print("ha ha ")
else:
print("na na")Output:ha ha
-----------------------------------------------------------------------------------------------
Comments
Post a Comment