x in my_iterable
my_iterable : iterable input.x not in my_iterable
my_iterable : iterable input.my_list=[3,4,5,8,3]
if(5 in my_list):
print("Yes it is Present")
else:
print("NO it is NOT Present")
Output
Yes it is Present
Example:
my_list=[3,4,5,8,3]
if(9 in my_list):
print("Yes it is Present")
else:
print("NO it is NOT Present")
Output
NO it is NOT Present
my_list=[3,4,5,8,3]
if(9 not in my_list):
print("Yes it is NOT Present")
else:
print("NO it is Present")
Output
Yes it is NOT Present
for i in range (0,5):
print(i,end=',')
Output
0,1,2,3,4,
url='plus2net.com'
if( '2' in url):
print("yes 2 is available inside")
else:
print("No 2 is not available inside ")
Output
yes 2 is available inside
We will use Dictionarymy_dict={0:'A',1:'B'}
print(1 in my_dict) # True
my_dict={0:'A',1:'B'}
print('A' in my_dict) # False
my_dict={'A':'X','B':'Y','C':'Z'}
print('X' in my_dict) # False
print('C' in my_dict) # True
print('Y' not in my_dict) # True
We will use tuplemy_tuple=(6,1,12,7)
print(7 in my_tuple) # True
my_tuple=(6,1,12,7)
print(8 not in my_tuple) # True
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.