By Lenin Mishra
Prerequisite - Installing Python on your machine
Although, you can learn to code in the Python Interactive session on your command line, you should use an Integrated Development Environment(IDE) for writing your Python code.
In this article, you will learn to install Visual Studio Code(VS Code) for Windows 10. However, you can use this process for any operating system.
Step 1 - Download Visual Studio Code
Visit the website of Visual Studio Code. It will automatically show you the right
exe file for your operating system. Click on the “Download” button.
exe file will be downloaded and you will be redirected to a “Thank you for downloading VS Code” page.
Step 2 - Installing VS Code
Click on the downloaded
exe file and it should open up the installer.
Check “I accept the agreement” and click on “Next>”.
You can choose to create a Desktop icon and add VS Code to your PATH. Make the choices you want and press “Next>” and then press “Install”.
Once the installation finishes, you will see the successful installation page. When you click on “Finish”, VS Code Editor will be launched.
Step 3 - Write your first program
Open VS Code and click on “File” and then “Open Folder”. For the purpose of this tutorial, we will create our python files inside a
trial folder present in Desktop.
trial folder, create a new python file called
Write your first Python code
However, you won’t be able to run your code. You need to understand that VS Code works like a simple text editor. It has no built-in support for Python.
To run Python code, you need to download the Python extension for VS Code.
Step 4 - Download Python extension for VS Code
Click on the Extension button on the left hand menu bar.
The Marketplace for VS Code Extensions should open up. Search for python in the search bar.
Choose the Python extension provided by Microsoft and click on “Install”.
Now when you go back to your
test.py file, you should be able to see a Run button.
Once you click on the Run button, your Python code will be successfully executed.
Check out installation guides for other Python IDEs.