Question:
I am learning Python
There is an exercise, the instruction given is : create a list called fruits including “pomme”, "banane"et “orange”
I write
I get this error message : File “main.py”, line 3
1. Créez une liste nommée fruits contenant les éléments "pomme", "banane" et "orange".
^^^^^
SyntaxError: invalid syntax
How should I write the list to have NO error message?
@boitardclaire
If your variable is called ‘I write fruits’, it won’t work as there cannot be spaces in the varuable name.
Instead, you can do I_write_fruits or IWriteFruits.
Hope this helps!
Well, it may be because of a specific platform or Python environment that you are currently using. One thing that I will recommend you to fix this error by checking you are running this code in a valid python environment such as Python IDE like Pycharm, Jupyter notebook or directly in a python script.
Thanks