Kinda newb-ish question

ChocoboMog123 ChocoboMog123 at msn.com
Thu Dec 11 19:50:21 EST 2003


What's wrong with line 8 in this code?
x=1
while 1==1:
    x=x+1
    y=range(1,x)
    z=0
    q=9
    for count in y:
        q=x%y
        if q==0:
            z=z+1
    if z<1:
        print x
It keeps giving me 
Traceback (most recent call last):
  File "C:\Python23\Prime Number.py", line 8, in -toplevel-
    q=x%y
TypeError: unsupported operand type(s) for %: 'int' and 'list'

It's supposed to be a program to print out prime numbers.
If anyone knows of a program that does this or can write one, can you
show me the code? Thanks.




More information about the Python-list mailing list