Skip to content

Commit d0980ff

Browse files
authored
Create subsets
1 parent ae66896 commit d0980ff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

subsets

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from itertools import chain, combinations
2+
def give_subsets(iterable):
3+
4+
l = list(iterable)
5+
return chain.from_iterable(combinations(l,n) for n in range(len(l)+1))
6+
7+
A = {1,2,3,4}
8+
list(give_subsets(A))

0 commit comments

Comments
 (0)