Computer Science, asked by Anonymous, 1 year ago

write a program to demonstrate membership operators in python! ​

Answers

Answered by mdzainulaabedin330
15

Explanation:

Python’s membership operators test for membership in a sequence, such as strings, lists, or tuples. There are two membership operators as explained below −

Answered by sm8699219
7

Answer:

Python Membership and Identity Operators | in, not in, is, is not

Membership Operators

Membership operators are operators used to validate the membership of a value. It test for membership in a sequence, such as strings, lists, or tuples.

in operator : The ‘in’ operator is used to check if a value exists in a sequence or not. Evaluates to true if it finds a variable in the specified sequence and false otherwise.

# Python program to illustrate

# Finding common member in list

# using 'in' operator

list1=[1,2,3,4,5]

list2=[6,7,8,9]

for item in list1:

if item in list2:

print("overlapping")

else:

print("not overlapping")

Similar questions