>>> a = [1, 3, 5]
>>> b = [1, 3, 5, 8]
>>> c = [3, 5, 9]
>>> set(a) <= set(b)
True
>>> set(c) <= set(b)
False
>>> a = ['yes', 'no', 'hmm']
>>> b = ['yes', 'no', 'hmm', 'well']
>>> c = ['sorry', 'no', 'hmm']
>>>
>>> set(a) <= set(b)
True
>>> set(c) <= set(b)
False
More Related Contents:
- I have a list of file names and I need to be able to count how many of the same file gets repeated for each file name [closed]
- How do I check if a list is empty?
- What’s the difference between lists and tuples?
- How to remove list elements in a for loop in Python? [duplicate]
- Iterate over all pairs of consecutive items in a list [duplicate]
- How Big can a Python List Get?
- Why is a list comprehension so much faster than appending to a list?
- Converting a String to a List of Words?
- How to perform element-wise multiplication of two lists?
- elegant find sub-list in list
- How to group a list of tuples/objects by similar index/attribute in python?
- How to force a list to a fixed size?
- Pandas expand rows from list data available in column
- How to check if an object is a list or tuple (but not string)?
- How to remove all duplicate items from a list [duplicate]
- Unpack list to variables
- Python using enumerate inside list comprehension
- How to find common elements in list of lists?
- How to convert a string list into an integer in python [duplicate]
- Convert list of strings to dictionary
- Most efficient way for a lookup/search in a huge list (python)
- How to make a completely unshared copy of a complicated list? (Deep copy is not enough)
- How can I partition (split up, divide) a list based on a condition?
- Python: Rename duplicates in list with progressive numbers without sorting list
- Loop through list with both content and index [duplicate]
- In Python, is there an elegant way to print a list in a custom format without explicit looping?
- Retrieve the two highest item from a list containing 100,000 integers
- Python find list lengths in a sublist
- Python: Random numbers into a list
- How to create a nested dictionary from a list in Python?