To successfully run Python code in VS code. First, You need to set up Python development environment. To set up Python development environment, you must have installed VS code, Python Extension and Python itself on your computer.
In this tutorial, we will learn "How to run Python in VS code" and we will do every necessary thing, which should be done. We will create python program and run that in VS code.
First of all, Download and Install Visual studio code editor. You can download VS code editor from their official website.
After downloading VS code editor on your computer. Now, you have to download Python and need to install on your computer. How can you do that? There is already a tutorial available on the website "How to Install Python on windows", You can read that too or you can watch video on our YouTube channel.
Open Visual studio code editor, You will see interface like this.
Look at the left side and Click on the Extensions icon or press "Ctrl + Shift + X". It will show side bar and in the side bar, you can see search bar on the top. Write "Python" in the search bar.
Click on the First extension and check whether this one made by Microsoft or not. You have to install Microsoft one.
Click on the install button and it will start installing the extension in your VS code. It would take some time in installing.
After completing installation, Click close the them and Click on the File at the top-left corner. Click on New File below it and then Click on the Python file shown as in picture below.
That will create a Python file, save that file where you want.
Now, Create your first Python program or write your first Python code.
Look at the top bar, Click on the Run and then Click on the Run without debugging or press Ctrl + F5. This will run your program.
After running the code, a Terminal will open that will show you the result or output of your program as shown in picture below.
This is how to run a Python program in VS Code in practice. If you’d like to see more programming tutorials, check out our YouTube channel, where we have plenty of video tutorials in English.