ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 08 Mar 2018 13:07:23 +0100how to find the syntax errorhttps://ask.sagemath.org/question/41435/how-to-find-the-syntax-error/ Hi
Here's a short code (copy-paste) that gets me syntax error
i=3
while i>0 :
print i, 'looping'
i=i-1
"<ipython-input-7-8e7eba3f21a0>", line 4
i=i-Integer(1)
I retyped it a second time; now it works, but I don't see any difference.
i=3
while i>0 :
print i, 'looping'
i=i-1
Retyping only the line 4 with the error won't help, retyping the previous lines or restarting the kernel won't help either.
It's like a phantom error Thu, 08 Mar 2018 12:58:58 +0100https://ask.sagemath.org/question/41435/how-to-find-the-syntax-error/Answer by florin for <p>Hi</p>
<p>Here's a short code (copy-paste) that gets me syntax error
i=3
while i>0 :
print i, 'looping'
i=i-1</p>
<p>"<ipython-input-7-8e7eba3f21a0>", line 4
i=i-Integer(1)</p>
<p>I retyped it a second time; now it works, but I don't see any difference.
i=3
while i>0 :
print i, 'looping'
i=i-1</p>
<p>Retyping only the line 4 with the error won't help, retyping the previous lines or restarting the kernel won't help either.
It's like a phantom error </p>
https://ask.sagemath.org/question/41435/how-to-find-the-syntax-error/?answer=41436#post-id-41436
The indentation was fine, I just didn't know how to preserve it in the question by copy paste
I indented the code with syntax error by hand to show you (but this still doesn't show in preview),
I recopied it into Sage, it works now. I'll go by a gun
i=3
while i>0 :
print i, 'looping'
i=i-1
Thu, 08 Mar 2018 13:07:23 +0100https://ask.sagemath.org/question/41435/how-to-find-the-syntax-error/?answer=41436#post-id-41436