A question.

DeHa deha at poczta.onet.pl
Tue Dec 12 06:32:09 EST 2000


Hi All!

    I am new to Python, and just try to write my first program. But I have a
small problem.

    My program should find first numbers in the set from 1 to 100000. I made
such a code:

first = range(100001)
first = first[1:]

for i in first:
    if i != []:
#until end of the list
        for j in first[first.index(i):]:                           #find all
numbers divided by i
            if j % i == 0:
                first[first.index(j): first.index(j)] = []    #and delete it
from the list

    And it doesn't work, and I don't konw why? Could anyone help me? I try
to find answer in the tutorial, but the information in it doesn't change
anything.

Dawid Hulisz






More information about the Python-list mailing list