Kinda newb-ish question
Duncan Smith
buzzard at urubu.freeserve.co.uk
Thu Dec 11 20:41:38 EST 2003
"ChocoboMog123" <ChocoboMog123 at msn.com> wrote in message
news:5c27220b.0312111650.7f0a128d at posting.google.com...
> 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'
>
The clue is in the traceback. 'y' is a list. Presumably you meant q = x %
count.
Duncan
More information about the Python-list
mailing list