Get Started Tutorial with Python on VS Code

  • by

A few months ago, I started a new journey in my Professional life. As a software developer, I have the necessity to stay informed and have knowledge of all development technologies. I saw that Python is one of the most required programming languages on the market, and I decided to start learning it, to continue developing my skills.

For this first tutorial, I will show you what you need to write your first Python program, what tools you need to code and run it. Also, introduce you to the VS Code (Visual Studio Code) development environment and how you can create your programs on the text editor.

python

So, first of all, you need to have Python installed on your machine. Click here to navigate to the official page and download the latest version. For this tutorial, we will use the newest one, version 3.8.2.

python official website
Python Official Website – Using Microsoft Edge Chromium

When the download is completed, install Python on your machine. Follow the next few images below to guide you. This process I’m showing here is for macOS, on Windows is practically the same. Basically, the only thing you need to do is follow the instructions, click on “Next” and the installation is complete.

install python on mac os
install python on mac os
install python on mac os
banner image

So, now Python is installed on your machine, what’s next?

visual studio code logo

First of all, you need a text editor to write your code, and the next step is to download the Visual Studio Code.
Download here

Let’s suppose that you already have it installed on your machine and start creating the development environment. Start opening Visual Studio code, and we need to install one extension called “Python”, developed by Microsoft, to add support for the language on the editor. Follow the instructions below:

  • Open Visual Studio Code
  • Click on the Extensions Button, on the left bar
  • Search for “Python” from Microsoft and click “Install”
  • Reload VS Code
python extension visual studio code

After the installation, it’s time to create our first Python program 💪🏼

With your Visual Studio open, create a new folder to save your program. Give the name you like. Next, on the menu, click on “File” and “New File” to create the project. Call it “hello.py” for example. The extension “.py” is for a python language.

With the file created, start to write some code. For this first, we will do the simple “Hello World” program. Start by creating a string variable to allocate what you want the program displays. I will call “msg” and pass the string “First Python Program!”. Before the variable declaration, you need to call the “print” method to display your message on the screen. Down below, you can see what the code looks like, very simple.

msg = "First Python Program!!"
print(msg)

Before you write your code, the last step is to run your first Python program, clicking on the button “Run python file on terminal” and see the results!

python visual studio

If you follow the instructions, your result should be like the image. The string “First Python Program!” will appear on your terminal and your first program is done!! Congratulations!!

And now, what’s next?

In the next tutorial, I will teach you how to request input from and display it on screen. I hope that you enjoy and learn something with this first python contact.

I would like to hear your thoughts, do you like it? Have some questions? Comment down below and I will answer you as quickly.

Leave a Reply

Your email address will not be published. Required fields are marked *