In this article, we will install Python and create the first “Hello World” application using Python.

What Is Python?

Python is a high-level, general-purpose, interpreted, Cross-Platform, Case Sensitive, and Object-Oriented programming Language. Python was created by Guido van Rossum and first released in 1991. It uses an Object-Oriented approach which makes the programmer write clear, logical code for projects. Python has become one of the most popular programming languages used in the world. It is easy to learn because its syntax is similar to the English language. It uses a new line to complete commands and indentation to indicate a block of code. Python is derived from C, C++, Algol-68, Unix Shell, and other scripting languages, etc. The latest version of the Python is Python 3.

Many large companies use Python, including Google, YouTube, Netflix, NASA, etc. It is open-source and available at free of cost. Python is used in Web Development, GUI Application, Scientific and Numeric Computing, Console based applications, Enterprise Application, Data Science, and Machine Learning.

Environment Setup

Python can be installed in multiple ways in a system.

You can directly download the python from https://www.python.org/ official website (as shown below). I am downloading Python for Windows. Python is also available for Mac OS and Linux.

Downloading Python 3





On clicking download, an .exe package of size 25 MB is downloaded. Click on it to start the installation. Make sure to add Python 3.7 to the Path variable. (You can also do it manually as well.)

Adding Python 3.7 to PATH





Open command prompt and type, "python --version" to check the version of Python installed on the system.

Checking version of Python installed





Run the Python command line interpreter by typing, "Python" in command prompt and pressing the enter key. Use the print function, which prints the given object on the Standard output device (Screen) or to the text stream file. For this demonstration, I am passing “Hello World” in the print function.

Passing "Hello World" in print function





Next, we are going to create a python (.py) file. Open any text editor available in the system. For example, In Windows, open Notepad. Write the simple print method and save it as MyFirstApp.py.

Saving the file as MyFirstApp.py





Now, run use the Python command followed by the script name (with its extension) and see the output in the command prompt.

Output in terminal





Setting Up Visual Studio Code for Python:

Go here to download Visual Studio Code. Becuase I am running on Windows, I will download setup for Windows. Once downloaded, run the installer.

Running installer





After successful installation, launch VS Code, click on the extension icon, and search extension for Python. Click on install. The extension will help us in providing intelligence, code formatting, debugging, etc.

Python extension for VSC





Now, open a folder where you want to save your Python code. Then click on add new file, give it a meaningful name, and write the Python code in it. I have written a simple code for this demonstration.

First example





Click on the debug icon and then start debugging. As I have created a single Python file, I selected the currently active Python file as debug configuration. In case your application did not start when you clicked the debug configuration option, you need to check the launch.json and settings.json files for the configuration-related issues.

Debugging the active Python file





The output of the application will be visible in the terminal, as well as in the debug console.

Output in terminal





IDLE for Python Development

Python (in Windows) comes with IDLE (Integrated Development and Learning Environment) which can also be used for learning purposes. Search IDLE in the start button search and launch it.