hello friends in this article i am going to tell you about “python hello world program in vs code”. if you are a beginner in python and want to know how to write python first program in vs code then this article will be very helpful for you, read till last…
writing a python first program is very exciting step in the world of programming. let’s go through the process of writing first “hello world” program in python.
Python first program hello world
To write python first program, follow these all steps carefully given below.
- install python: if you want to write Python first program on your computer then you must install Python in your computer from Python’s official website or click on this link (https://www.python.org/downloads/). after downloading Python from the official website, double click on the file you downloaded and then follow step-by-step installation instructions.
if you have installed Python in your system then to check, python is correctly installed in your computer or not. open your cmd (for Windows users) or terminal (for Mac users) and then type “python3”. if python installation is successful in your computer then it will show you the python version on the screen. if not then you must have made some mistake installing python.
2. choose a Text Editor : to write a python program you should have a text editor. as a beginner notepad and text edit will be better for you. otherwise you can choose any kind of text editor from here.
- visual studio code
- sublime text editor
if you also go with visual studio code editor then you can download visual studio code by clicking this link.
i assume that you have successfully installed visual studio code in your computer. let’s start writing python first program using visual studio code.
Python first program in visual studio code :
To write python first program, open visual studio code and in the left side you will see some icons, click on the 5th icon from the top named extension. click on the icon and install two extensions “python” and “code runner” by typing on the search bar. these are two basic extensions to run python program efficiently.
Now it’s time to write actual code for python first program in visual studio code, so let’s get started….
1). first of all we have to create a new file in which we will write our python code. so, when you will open the visual studio code,”new file” option will be shown on the screen as shown in the picture below, just click on it.
after giving name to file, press enter. now it’s time to select a location/folder where you want to store your file, just select a folder and click on “create”, your file will be successfully created.
2) After clicking on the “new file” option, an empty search box will appear on the top of the screen as shown in the picture below. here you have to give a name to your new file you are going to create. you can give any name to your file. in my case it’s “hello.py”.
3) now you have a new file named “hello.py” and it’s time to write actual code on it of our “python first hello world program”. now write the same python code given below or you can copy it and paste. (python hello world program example)
here, “print()” is a pre-built function in python which is used to print the content which is inside the double quotes.
4) After writing code you have to execute and run the written code. for this, right click on the Editor and click on the option “Run Code”. once you run the code, the output of the written code will be shown in the terminal as shown in the picture below.
congratulations, you have successfully made your first python program hello world. now it’s time to explore more in python for which you can read python related articles in my blog.