Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Shorter Set by Oleg_Levonjuk
def remove_min_max(data: set, total:int) -> set:
return set(sorted(data)[total:-total]) 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!")
Dec. 31, 2021
Comments: