python : How to make a combination according to the count of elements?

import random import itertools method_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] random.shuffle(method_list) per = list(itertools.permutations(method_list, 4)) for ele in per: ss = set(list(ele)) if len(ss) == 4: if not ('h' in ss and 'i' in ss): result.append(ss) I want to make a total of 250 random combinations by taking 4 elements … Read more