Why does my compiler say invalid syntax then highlight...?
bbxx789_05ss at yahoo.com
Tue Mar 11 04:54:12 CET 2008
On Mar 10, 9:44 pm, Nathan Pinno <MadComputer... at gmail.com> wrote:
> Why does my compiler say invalid syntax and then highlight the
> quotation marks in the following code:
> # This program is to find primes.
> primes = 
> import math
> import gmpy
> while 1:
> run = int(raw_input("Do you want to calculate primes? 1 = yes and
> 2 = no. "))
> if run == 1:
> y = int(raw_input("What number do you want to use as the final
> number to calculate with? "))
> x = int(raw_input("What number do you want to start
> calculating primes from? "))
> while x < 2:
> print "Number must be at least 2 for math reasons."
> while x < y:
> prime = math.cos(gmpy.pi(0) * gmpy.fac((x-1)) / x)
> if prime < 0:
> print x " is not prime. " # highlights the final "
> x = x + 1
> print primes
> elif run == 2:
> print "Sorry, not a choice. Please enter your choice again."
> print "Goodbye."
> How do I fix such an invalid syntax?
> Nathan Pinno
Rather, try running this:
print 10 "Hello world."
More information about the Python-list