Ad Code

✨🎆 Diwali Dhamaka Offer! 🎆✨

Get 20% OFF on All Courses at Shiva Concept Solution click

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



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

Post a Comment

2 Comments

  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 Answer of Questions and ASK to Doubt