What's up guys. In this video, I'm going to
show you how to set up VS code for Python and run python codes on a Windows operating
system. To do this, you need to have Python and vs code installed in your PC. So let's first
check if we have python in our system. So open your taskbar and type in CMD to open command
prompt. Here, type in Python --version and hit enter. This shows that we don't have python
in our system. If you have it on your system, it would show you the version of python. So let's
quickly install Python and then VS code. Now, to install the latest version of python,
simply go to your browser and type in Python on the search bar, and then hit
enter. Now, click on the first link, which shows you python.org. This opens up the
official site of python. I'm going to put this link in the description so that you can simply
click on it and navigate the site. Here, go to downloads and you can see that it automatically
identifies my Windows operating system. If you are in a different operating system, just
go to the option for your operating system. To download it for Windows operating system,
simply click on this python 3.12 and it starts downloading. Once the download is finished,
click on this setup file. This opens up the installation wizard for the latest version
of python. Now let's minimize our browser and here check this "add python.exe to
path", as it's very important to execute your programs and automatically set the
path. Then click on customize installation, and here you can see that all the options
are correctly checked. Click on next and here it's important to check this option "install
python 3.12 for all users". Now, simply click on install and it's going to start installing.
It will ask you administrative privilege, so click on yes and it continues installing.
Wait for a couple of seconds to get it installed. Now you can see that our python setup
was successful. So simply click on close. And now let's check if we have installed
python correctly in our system. Therefore, go to your taskbar and type in CMD to open command prompt. Here type in Python --version and
hit enter. You can see that the latest version of python is correctly installed in
our system. Now we have python installed. So let's install the IDE. So to install it,
open up your browser and on the URL bar, type in code.visualstudio.com and hit enter. This
opens up the official site of Visual Studio code, where you can download the installer. Here,
it automatically identifies my Windows operating system. If you want to download it for a
different operating system other than the windows, you can click the down arrow and select the option
for your operating system. So to download it for Windows, simply click on download for Windows and
wait for a couple of seconds until the setup for the installer is fully downloaded. Once it
finished downloading, click on open folder. Now double click on this setup file to install.
Here, simply accept the agreement and click on next. Now keep the default location as it
is and click on next. Again next. Here, it's important to check the first option to create
a desktop icon, and check this option to add the open with code action to Windows Explorer File
context menu, and finally check this option to enable the same action for directory context
menu. And then click on next. Now simply click on install and it's going to start installing. And
finally, click on finish. This launches the visual studio code. So we have Visual Studio code ready
for coding in our system. So let's see how to set up VS Code for python. First, open the VS Code
by typing in Visual Studio code at your taskbar, or from your desktop shortcut. Here, let's
create a new file to see what it looks like to run python codes before setting up the VS
code for python. So let's create a new file. Go to file and click on new file. Here let's
type in print inside of parenthesis and double quotes hello world and save it. You can save it
anywhere you want. Let me save it in my desktop and since it's a python file, it should have
.py extension. So let's say first_program.py and click on Save. Now we have our python code
ready. So let's run our first program. Normally, we run it using our terminal. So click on this new
terminal and it opens up this window here at the bottom on which we have this terminal, Debbug
console, output and problems. right? So go to the folder where we have this file setup, that
is saved in my desktop. So type in CD and then desktop and hit enter. Now we can run our file by
typing in Python and the name of the program which is first_program.py and hit enter. This shows the
output hello world as expected. But the thing is, we don't want to write this much command every
time we want to run our code. right? Therefore, we need to set up the VS code for python. So we
need to install two important extensions. So go to extensions and type in Python on the search
bar to install python extension. Click on the first extension made by Microsoft, and click on
install. Once this extension finished installing, Search for another important extension called
code Runner. So type in code Runner and click on install. This extension helps you to run any
code In C, C++, Java, Python and more. After installing this extension, we are now able to see
this run button at the top right corner. Now we can go to our file, first_program.py and click on
this run button. Or right click on the program and it perfectly runs our code. All right, we are
now all set to write and run any python codes on vscode. So thank you very much for watching
and don't forget to like, share and subscribe. [Music]