subsets

🏠
1 def subsets(nums):
2     res = [[]]
3     for n in sorted(nums):
4         res += [r + [n] for r in res]
5     return res
6 
7 
8 print(subsets([1, 2, 3]))