Programming with Python

⌘K
  1. Home
  2. Docs
  3. Programming with Python
  4. Variables, Expression and...
  5. Operators and Types of Op...
  6. Membership Operators

Membership Operators

Membership operators are used to test if a sequence is presented in an object

Example

x=["python","chemistry"]
print("python in x", "python" in x)
print("pysics not in x", "pysics" not in x)

Output

('python in x', True)
('pysics not in x', True)

Loading

Views: 5

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments