Q:

Cannot get this loop to stop

Why will this not stop when len(prime) increments to 9, 
I also tried using the counter but that did not work either.  In this case it runs until it has check for primes to 100 not until if finds the first 10 primes.
    prime = [2]

    odd_list = [x for x in range(100) if x % 2 != 0 and x > 2]
    count = 0
    while len(prime) < 10:
        for z in odd_list:
            for y in range(2, z):
                if z % y == 0:              # is not prime
                    break
            else:
                prime.append(z)
                count += 1
    print 'count = ', count
    print 'length of prime =', len(prime)
    print prime

A:

You need to check number of primes in internal loop:
prime = [2]

odd_list = [x for x in range(100) if x % 2 != 0 and x > 2]
count = 0
for z in odd_list:
    for y in range(2, z):
        if z % y == 0:              # is not prime
            break
    else:
        prime.append(z)
        count += 1

    if len(prime) >= 10:
        break
print 'count = ', count
print 'length of prime =', len(prime)
print prime

In each interation of external while loop you run whole for loop:
while len(prime) < 10:
    for z in odd_list:
        ...

so after first while iteration all primes will already be found, and only then you will stop while loop.

