Например, так?
a = [{min(a): max(a), max(a): min(a)}.get(x, x) for x in a]
Ещё варианты:
a[:] = map(lambda x: min(a) if x == max(a) else max(a) if x == min(a) else x, a)
d = {min(a), max(a)}
a[:] = (sum(d) - x if x in d else x for x in a)
d = {min(a), max(a)}
a[:] = ((d & {sum(d) - x} or {x}).pop() for x in a)
from operator import itemgetter
(i_min, v_min), *_, (i_max, v_max) = sorted(enumerate(a), key=itemgetter(1))
a[i_min], a[i_max] = v_max, v_min
i_min, v_min = min(enumerate(a), key=itemgetter(1))
i_max, a[i_min] = max(enumerate(a), key=itemgetter(1))
a[i_max] = v_min