is,is not operator and in ,not in operator in LIST in Python

2


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]
if x is y:
   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")
Tags

Post a Comment

2Comments

POST Answer of Questions and ASK to Doubt

  1. 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.")

    ReplyDelete
  2. Program of IS operator--->

    y=["Python","Java","C","C++","VB"]
    if ".Net" in y:
    print("it is there")
    else:
    print("it is not there")

    ReplyDelete
Post a Comment