Answer:
# Python Program to Print
# all subsets of given size of a set
import itertools
def findsubsets(s, n):
return list(itertools.combinations(s, n))
# Driver Code
s = {1, 2, 3}
n = 2
print(findsubsets(s, n))
-----------------------------------------------
# Python Program to Print
# all subsets of given size of a set
import itertools
# def findsubsets(s, n):
def findsubsets(s, n):
return [set(i) for i in itertools.combinations(s, n)]
# Driver Code
s = {1, 2, 3, 4}
n = 3
print(findsubsets(s, n))
-------------------------------------------------------------
# Python Program to Print
# all subsets of given size of a set
import itertools
from itertools import combinations, chain
def findsubsets(s, n):
return list(map(set, itertools.combinations(s, n)))
# Driver Code
s = {1, 2, 3}
n = 2
print(findsubsets(s, n))