element in list
if 2 in [1, 2, 3]:
print('2 in list')
else:
print('2 in not list')
if 4 in [1, 2, 3]:
print('4 in list')
else:
print('4 in not list')
if (1,2) in [(1, 2) , (3, 2)]:
print('(1,2) in list')
else:
print('(1,2) in not list')
result
element no in list
if 4 not in [1, 2, 3]:
print('4 not in list')
else:
print('4 in list')
if (1,2) not in [(1, 2), (3, 2)]:
print('(1,2) in not linst')
else:
print('(1,2) in list')
result
No comments:
Post a Comment