I am quite new to VS code and I am trying very simple tasks in Python in without great success.
So far I installed Python 3.12.1 on my Mac and also downloaded the plugins "Code runner", "Python" and "Pylance" within VS code (I did everything on the same day). I am just following the instructions of a Udemy corse.
However, while typing the simple following commands, the output of VS code is a bit weird to me and different as I write the same in my terminal:
The output of the basic print() function
Moreover, while changing the parameter sep=
from default to something else (like sep = "--"
), VS code gives me an error, while the same command works just fine in the terminal.
I suspect there is something wrong in VS code but I can’t figure out what.
PS: the version of Python running in VS code matches that of what it should be (3.12.1)
2
Answers
So, like others mentioned it is the problem with the version, although u did mention u r using python 3.x, It is running fine in my vs code and IDLE. When I tried to run in an online 2.x interpreter it matched the error.
Things u can check are:
All the best!
Please use the official extension Python executing script.
https://code.visualstudio.com/docs/python/python-tutorial