Powerset
Returns the powerset of a given iterable.
- Use
list()to convert the given value to a list. - Use
range()anditertools.combinations()to create a generator that returns all subsets. - Use
itertools.chain.from_iterable()andlist()to consume the generator and return a list.