How to use is, is not and in, not in operator in LIST:-
"Is" the operator is used to compare the address of the list variable, tuple, set, and dictionary, if they point to the same address then it returns true otherwise returns false?
x = [1,2,3]
y = [1,2,3]
"Is" the operator is used to compare the address of the list variable, tuple, set, and dictionary, if they point to the same address then it returns true otherwise returns false?
x = [1,2,3]
y = [1,2,3]
if x is y:
print("equall")
else:
print("not equall")
print("equall")
else:
print("not equall")
o/p not equal
Is not operator is opposite of Is operator.
In operator is used to check that element is exists or not in List, Tuple, Dictionary, and Set type variable.
Example of In Operator:-
x = [1,2,3,4,5]
if 21 in x:
print("exist")
else:
print("not exist")
Example of In Operator:-
x = [1,2,3,4,5]
if 21 in x:
print("exist")
else:
print("not exist")
Q:- Implementation of "is" in Pythone Program ?
ردحذفSolution:-
a= ["Computer", "Laptop", "Android", "iPhone","Windows"]
if "Linux" in a:
print("It is Presented in List.")
else:
print("It is Not Presented in List.")
Program of IS operator--->
ردحذفy=["Python","Java","C","C++","VB"]
if ".Net" in y:
print("it is there")
else:
print("it is not there")