Jan-24-2018, 07:04 PM
Hi,
I am learning how to use Python (I have previous coding experience with R), and started using Spyder. I am getting unexpected errors when trying to run for loops or if statements (I would probably get similar errors for other things too). This is an example:
And the error:
The weird thing is that when running this script from terminal, it does work! There is no error at all and the output is correct. Why would it only be giving an error in Spyder? I have looked for unwanted spaces or tabs after the ":" and there are none. My indentation also seems ok... Thanks for your help.
I am learning how to use Python (I have previous coding experience with R), and started using Spyder. I am getting unexpected errors when trying to run for loops or if statements (I would probably get similar errors for other things too). This is an example:
1 2 |
for a in range ( 1 , 10 ): print (a) |
1 2 3 4 5 |
for a in range ( 1 , 10 ): File "<ipython-input-96-c0095e732a72>" , line 1 for a in range ( 1 , 10 ): ^ SyntaxError: unexpected EOF while parsing |