In this tutorial, we will discuss how to create a hello world program in python, and also, we will see how to download and install visual studio code in windows 10.
What is Visual Studio Code?
Microsoft provides a Visual Studio Code the free and open-source code editor. It is fast and straightforward. Visual Studio Code supports all three operating systems like Windows, Linux, and macOS.
It has a lot of built-in features like GitHub, debugging and embedded Git control, syntax highlighting, snippets, and intelligent code completion. Also, you can add extensions to create a Python development environment as per your need.
VS Code is lightweight and it has many powerful features. This is the reason why it becoming popular among Python developers. Visual studio code is a code editor that you can use for python development. This is not only mean for python, It supports other languages also.
If you are new to python, you can check below tutorials:
- Python download and Installation steps
- Why python is so popular?
- How to create a list in Python
- What is Python and What is the main use of Python?
- How does python work? how python is interpreted?
- Python Hello World Program (using Pycharm)
- How to create a variable in python
Download and Install Visual Studio Code in Windows 10
Let’s see how to download and install free visual studio code (VS Code).
First download visual studio code. Based on the operating system, you can download VS Code.
- After downloading, Open the VS Code and then accept the agreement and click on Next.
- Once you will click on Next, a default location will appear. If you don’t want to change the default location then click on Next.
Now click on “create a desktop icon” so that it can be accessed from desktop and then click on Next.
After that, click on the Install button. It will start installing the VS Code.
Finally, installation completes, and by default the Launch Visual Studio Code will appear with check mark. Click on the Finish button, and the visual studio code will get open.
Now you can see Visual Studio Code has been started on windows 10.
Install Python Extension for Visual Studio Code
To install the extension, open up the extension, menu which is present on the left side, and write on the search space “Python”.
Then select the first one that pops up, You can click Install for the respective extension.
Create hello world program in python using Visual Studio Code
Now, we will see how to create hello world program in python in vs code.
Open visual studio code. Then File -> New File.
Then in the file write the below code:
msg = "Hello World" print(msg)
Then Save the file Ctrl+S and then give a file name with .py extension and save type as Python.
The file will looks like below:
To Run the code, Right-click anywhere in the editor window and select Run Python File in Terminal.
The output you can see in the Terminal like below:
You can also, Run the code manually using the command line by simply writing python and Path of the file in the terminal.
You can see below, I have copied the Path of the File after writing python.
Now, If you enter then you will see the Output.
So, In this Python tutorial, we learned how to create hello world program in python using visual studio code. and how to download and install Visual Studio Code in windows 10, and also we have seen how to install Python Extensions in vs code.