Why does my compiler say invalid syntax then highlight...?
MadComputerGuy at gmail.com
Tue Mar 11 04:44:52 CET 2008
Why does my compiler say invalid syntax and then highlight the
quotation marks in the following code:
# This program is to find primes.
primes = 
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
elif run == 2:
print "Sorry, not a choice. Please enter your choice again."
How do I fix such an invalid syntax?
More information about the Python-list