Invalid Syntax error python 3.5.2
<p>I'm getting syntax error in this particular line.</p>

<pre><code>print "Sense %i:" %(i),
</code></pre>

<p><strong>Full code:</strong></p>

<pre><code>for i in range(len(meas)):
    p = sense(p, meas[i])
    r = [format(j,'.3f') for j in p]
    print "Sense %i:" % (i),
    print r,
    entropy(p)
    p = move(p, mov[i])
    r = [format(j,'.3f') for j in p]
    print "Move %i:" % (i),
    print r,
    entropy(p)
    print
</code></pre>

<p>Several things:</p>

<ul>
<li>In Python 3, <code>print</code> is a function, no more a statement like it was with Python 2. So, you need to add parenthesis to call the function,</li>
<li>the <code>%</code> operator used for string formatting is deprecated. With Python 3, you should use the <code>format</code> method (or the <code>format</code> function),</li>
<li>the <code>%</code> operator usually take a <code>tuple</code> as a second parameter: the expression "(i)" is not a <code>tuple</code> but a constant. With Python, the singleton <code>tuple</code> has a trailing comma like this: "(i,)".</li>
<li>use the keyword argument <code>end=""</code> to replace the newline by an empty string (but I'm not sure this is what you want)</li>
</ul>

<p>So, you can replace your code by:</p>

<pre><code>print("Sense {}:".format(i), end="")
</code></pre>

<p><strong>EDIT: add code from comment</strong></p>

<p>Your code should be converted in Python 3 like bellow:</p>

<pre><code>for i in range(len(meas)):
    p = sense(p, meas[i])
    r = [format(j,'.3f') for j in p]
    print("Sense {0}:".format(i), end="")
    print(r, end="")
    entropy(p)
    p = move(p, mov[i])
    r = [format(j,'.3f') for j in p]
    print("Move {0}:".format(i), end="")
    print(r, end="")
    entropy(p)
    print()
</code></pre>

python python-3.x syntax