Bonjour,
the execution fails if you simply copy/paste the code in the Python console of Spyder:
>>> if a < 0:
... print('a is smaller than zero')
else:
print('a is greater than , or equal to zero')
......
File "<string>", line 3
else:
^
SyntaxError: unexpected EOF while parsing
The symbol "..." is a secondary prompt. Every new line in a block of code must start with this prompt.
Here is the good syntax (entered manually):
>>> if a < 0:
... print('a is smaller than zero')
...else:
... print('a is greater than , or equal to zero')
...
a is greater than , or equal to zero
>>>
Fusion 360 is distributed with an outdated version of Spyder (2.3.2 released in 2012). The Python console was removed from Spyder in version 3.2. It was replaced by an IPython console in which you can safely copy/past and execute the code.
From a separate Python installation (Anaconda with Spyder 3.2.5):
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 6.1.0 -- An enhanced Interactive Python.
In [1]: a = 5
In [2]: if a < 0:
...: print('a is smaller than zero')
...: else:
...: print('a is greater than , or equal to zero')
...:
a is greater than , or equal to zero
In [3]:
It's up to the Fusion 360 team to upgrade the Spyder IDE. But I read in a previous post that they built a custom Python environment. So it's probably easier said than done.