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