While loop returned nothing at all and removing duplicates of min max
<p>1) upon entering input >> 1 2 3 4 5 6 7
the result returned nothing. Must be the while loop i supposed? </p>

<p>2) Also for input such as >> 1 1 1 5 5 7 7 7 7
how do i remove duplicate of 1 and 7? ; meaning duplicate of min and max.
I plan to average the number input by removing duplicate of min and max.
Do i combine max() min() function with list(set(x)) or is there another way round?</p>

<p>New to python here. WHILE permitted only. Do not suggest For</p>

<pre><code>even_sum, odd_sum = 0,0
evencount, oddcount = 0,0
count=0
n=0

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

while count&lt;numbers:
     if numbers[n]%2==0:
         evencount = evencount +1# len(numbers)
         even_sum += num
         count=count+1
         n=n+1
else:
        oddcount = oddcount+1#len(numbers)
        odd_sum += num
        count=count+1
        n=n+1

max123 = max(numbers)
min123 = min(numbers)
difference = max123 - min123



print numbers 
numbers.remove(max(numbers))
numbers.remove(min(numbers))

average = sum(numbers)/float(len(numbers))

print "The summation of even and odd numbers are " + str(even_sum) + " and " + str(odd_sum)
print "The difference between biggest and smallest number is " + str(difference)
print "The count of even numbers and odd numbers are " + str(evencount) + " &amp; " + str(oddcount)

print average
</code></pre>

<p>This is wrong:</p>

<pre><code>while count&lt;numbers:
</code></pre>

<p>You are comparing a number to a list. That is valid, but it does not do what you might expect. <code>count&lt;numbers</code> is always true, so you are stuck in an infinite loop. Try it:</p>

<pre><code>&gt;&gt;&gt; 1000000 &lt; [1, 2]
True
</code></pre>

<p>What you want to do instead is iterate through all numbers.</p>

<pre><code>for number in numbers:
    if number % 2 == 0:
        ...
</code></pre>

<p>You don't need <code>count</code> and you don't need <code>n</code> either.</p>

<hr>

<p>Also, the <code>else:</code> should be indented, otherwise it will never be executed with this code.</p>

<hr>

<p><strong>Handicap mode</strong> (without <code>for</code>)</p>

<pre><code>n = 0
odd_count = 0
odd_sum = 0

while n &lt; len(numbers):
    number = numbers[n]
    if number % 2:
        odd_count += 1
        odd_sum += number
    n += 1

# "even" values can be calculated from odds and totals
</code></pre>

python