Visual Studio Code is an excellent IDE (integrated developer environment) that you can use to help write Python code. You can download VS code from the official website at code.visualstudio.com:

Visual Studio Code downloader

Download and install VS Code by selecting the appropriate option. Since this is a Windows course, we are clicking the Windows download button on the left. Once the download completes, run the installer with the default options and start VS Code:

Visual Studio Code Home Screen

Here you can configure the theme you want to use, then let's create a project folder. In VS Code, clcik File > Open Folder:

Open Folder in Visual Studio Code

Browse to the directory where you want to save your Python files for this course, right-click and click New > Folder.

Name it whatever you think is appropriate then click Select Folder:

Next, select Yes when asked about trusting the authors:

VS Code Do you trust the authors of the files in this folder?

Now we can create Python files and folders inside of this directory as desired and they will all be quickly accessible from our VS Code editor. I prefer to have a folder for each project I work on in VS code - but you are free to work any way you see fit. Having a single folder for your work in this course is a great option!

Right-click in the explorer pane and select New File. Name it test.py then press Enter.

VS Code create a new Python file

The new file will open:

Install the Python 3 recommended extension for VS code

Wait for the module installation to complete. This will install the Python module by Microsoft which includes IntelliSense (autocompletion), Linting, debugging and more! If you receive a Windows Security Alert, click Allow Access:

Allow access for VS Code Python module

Copy and paste the following test code into the test.py file:

print("Hello Server Academy")

Now we can execute our Python files by pressing F5. Click Python File when prompted:

Now if we look in the terminal we will see our executed code:

Python Executed code

And that's all we need to do to get started writing Python code in Visual Studio Code!

0 0 votes
Lesson Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments