Question::
Write a function
Code::
def is_member(d,n):
for i in n:
if(d==i):
return True
return False
n=input("Enter list:")
nt=n.split(",")
d=input("Enter Value to be searched:")
if(is_member(d,nt)):
print("Yes it is Present")
else:
print("No it is not Present")
Write a function
is_member()
that takes a value (i.e. a number, string, etc) x
and a list of values a
, and returns True
if x
is a member of a
, False
otherwise.Code::
def is_member(d,n):
for i in n:
if(d==i):
return True
return False
n=input("Enter list:")
nt=n.split(",")
d=input("Enter Value to be searched:")
if(is_member(d,nt)):
print("Yes it is Present")
else:
print("No it is not Present")
Output::