is , not is ( Identity Operators)

x is y
x, y : input objects
Return boolean value True or False. Returns True if both side operands are of same type, otherwise False

x is not y
x, y : input objects
Return boolean value True or False. Returns True if both side operands are NOT of same type, otherwise False

Using integer

x=500
print(type(x) is int) # True
Using float
x=100.34
print(type(x) is int)  # False
x=100.34
print(type(x) is float) # True
x=30
y=400
print(type(x) is type(y)) # True

Using list

More on list

Example
my_list1=[1,2,3]
my_list2=[4,5,6]
print(type(my_list1) is type(my_list2)) # True
Using frozenset()
my_list1=[1,2,3]
my_list2=frozenset([4,5,6])
print(type(my_list1) is type(my_list2)) # False
Using boolean
x=True
y=False
print(type(x) is type(y)) # True

Example using is not

x=56.78
y=100
print((x  is not y)) # True
in and not in: The Membership operators Iterator any()

Your Rating




Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer