Remove max and min duplicate of a list of number
<p>I would like to remove ONLY the maximum and minimum duplicate of a list of
numbers. Example: (<strong>1 1 1</strong> 4 4 5 6 <strong>8 8 8</strong>) Result: (<strong>1</strong> 4 4 5 6
<strong>8</strong>)</p>

<p>How do I combine max() min() function with <code>list(set(x))</code>?</p>

<p>Or is there another way?</p>

<pre><code>s = raw_input("Please Input a series of numbers")
numbers = map(int, s.split())

numbers.remove(max(numbers))
numbers.remove(min(numbers))
average = sum(numbers)/float(len(numbers))
print average
</code></pre>

<pre><code>s = raw_input("Please Input a series of numbers")
numbers = map(int, s.split())
# numbers = [1, 1, 1, 4, 4, 5, 6, 8, 8, 8]
mi = min(numbers)
ma = max(numbers)
b = [mi] + [x for x in numbers if x != mi and x != ma] + [ma]
</code></pre>

python