Why do I get an invalid syntax error on the "i" in the for loop (python) : <p>I am learning to program with Python. Currently, I am trying to write a simple function that will check to see if a number that the user has entered is prime. The following portion of the function is throwing up an "invalid syntax" sign: </p>

<pre><code>else:
    For x in range(1,b**(1/2)):
        If b%x==0:
            print(str(b) + " is not prime")
            break
</code></pre>

<p>"b" is a variable defined elsewhere in the function. It is an integer less than 500 that the user provides. I am getting an "invalid syntax" error pointing at the "x" in the "for x in range..." part of the code. I don't understand why this is the case and would greatly appreciate some insight into this problem.</p>

<p>If it helps, so far, the entire code looks as follows:</p>

<pre><code>def check_prime():
   b = input("Enter an integer less than 500: ")
   if type(b)!='int':
       print("Please enter an integer")
   elif b &gt; 500:
       print ("Please choose a smaller number")
   else:
       For x in range(1,b**(1/2)):
           If b%x==0:
              print(str(b) + " is not prime")
              break
       print (str(b)+ " is prime")
</code></pre>

<p>I am aware that the function will not work exactly as I intend just yet, but I do not know how to move forward until I resolve the issue of the syntax error. Thank you, in advance, for your help.</p>
