Python errors confusing a Python noobie -
literally started learning python today , i'm ready pull hair out on errors i'm not understanding.
here errors getting when try run script:
and here script in question:
primes = [] x = raw_input('enter max value check primes: ') num in range(2, x+1): if len(primes) == 0: primes.append(num) else: prime in primes: if (num % prime == 0): break primes.append(num) number in primes: print number
from errors received far, looks cannot declare blank list, , doesn't input method. copied these lines more or less out of tutorial worked, , confused why work there not here. appreciated.
the error messages posted start "command not found", implies running python script not in python, in shell. fix it, either run python question7.py
, or add #!/usr/bin/env python
first line of script (this known shebang line, , tells interpreter let python run script instead).
Comments
Post a Comment