how to use python on visual studio code

Master Python with Visual Studio Code: A Step-by-Step Guide

By Olivia Lopez
AD

Python, a widely-used high-level programming language, has earned top spots in the data science and machine learning landscapes, commanding approximately 70% of the data science community. Coupled with a robust Integrated Development Environment (IDE) like Visual Studio Code (VS Code), Python developers can exponentiate their productivity and efficiency.

VS Code, developed by Microsoft, is a Source Code Editor that caters to a wide array of programming languages, including Python. VS Code offer an extensive range of features, such as debugging, drag, and drop file support, Git Command Line built-in, and IntelliSense (a feature that offers suggestions and visual support to create better code).

Setting up Python with Visual Studio Code

Before utilizing Python on VS Code, you must first install required tools.

AD
Learn Python with Visual Studio
Learn Python with Visual Studio
Learn Python 3: Visual Studio Code for Beginners
Learn Python 3: Visual Studio Code for Beginners
Getting Started with Python in Visual Studio Code | Python with VSCode
Getting Started with Python in Visual Studio Code | Python with VSCode

Install Python. Download and extract the Python installation file. Find the installer in your file browser and open it. Run the installer and follow the prompts. Python and pip should be installed in their default locations.

Installing Visual Studio Code

Download and install Visual Studio Code on your machine. Open the installer and follow the prompts to complete the installation.

Getting Started with Python in Visual Studio Code | Python with VSCode
Getting Started with Python in Visual Studio Code | Python with VSCode
Remote Python Development in Visual Studio Code - Microsoft for Python Developers Blog
Remote Python Development in Visual Studio Code - Microsoft for Python Developers Blog

Upon completion, open VS Code. Now, let's connect your VS Code with Python.

Python Extension for VS Code

Visual Studio Code must know where Python and pip are. Click on Extensions (the icon with four squares at the side-bar). In the search bar of the Extensions page, type 'Python'. Click on the Python extension 'Python by Microsoft' and hit install. Restart VS Code.

AD

Upon reopening VS Code, navigate to the command palette (Press 'Ctrl+Shift+P' or 'Cmd+Shift+P' on Mac). Search for 'Python: Select Interpreter' and select your installed Python interpreter. Now, VS Code will understand where Python and pip are.

Developing and Running Python Code

With Python and VS Code properly setup, you can start writing and executing Python codes.

Over on your file system, create a new text file, and name it 'main.py'. Click on File > Save in VS Code and save 'main.py'. A simple Python program may look like this:

AD
```python print('Hello World!') ```

Testing Your Python Code

The easiest way to run your Python code is to press 'Ctrl+F5' on your keyboard. To see detailed output, you can use 'Ctrl+Alt+N' for a new terminal, then type 'python main.py'.

ját Bard, princesse des cerisiers, avait été.Login à un festival de sculpture traditionnel par les jumelles inversées - Eli et Illya, l'héritier de Niconar. Des romans écritops dans son slaughter poururoy ra la teçSaint extending subheading with two paragraphs of detailed text.

AD