Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First (='ω'=) solution in Clear category for Shorter Set by Magu
def remove_min_max(data: set, total:int) -> set:
s = set(sorted(list(data))[total:-total])
return s if total else data
print('Example:')
print(remove_min_max({4,5,6,7}, 1))
assert remove_min_max({8, 9, 18, 7}, 1) == {8, 9}
assert remove_min_max({8, 9, 7}, 0) == {8, 9, 7}
assert remove_min_max({8, 9, 7}, 2) == set()
assert remove_min_max({1, 2, 7, 8, 9}, 2) == {7}
assert remove_min_max(set(), 1) == set()
print("The first mission is done! Click 'Check' to earn cool rewards!")
Nov. 3, 2021