Lista de Python contiene lista
>>> items = set([-1, 0, 1, 2])
>>> set([1, 2]).issubset(items)
True
>>> set([1, 3]).issubset(items)
False
DreamCoder
>>> items = set([-1, 0, 1, 2])
>>> set([1, 2]).issubset(items)
True
>>> set([1, 3]).issubset(items)
False
# List of string
listOfStrings = ['Hi' , 'hello', 'at', 'this', 'there', 'from']
'''
check if element exist in list using 'in'
'''
if 'at' in listOfStrings :
print("Yes, 'at' found in List : " , listOfStrings)
'''
check if element NOT exist in list using 'in'
'''
if 'time' not in listOfStrings :
print("Yes, 'time' NOT found in List : " , listOfStrings)
#There's an all() and any() function to do this. To check if big contains ALL elements in small
result = all(elem in big for elem in small)
#To check if small contains ANY elements in big
result = any(elem in big for elem in small)
#the variable result would be boolean (TRUE/FALSE).