blob: ac44fae5fb5e8876035a47ea8fb1ba766445ebb7 (
plain)
1
2
3
4
5
6
7
8
9
10
|
def extract_min_max(test_tup, K):
res = []
test_tup = list(test_tup)
temp = sorted(test_tup)
for idx, val in enumerate(temp):
if idx < K or idx >= len(temp) - K:
res.append(val)
res = tuple(res)
return (res)
|