Python is a simple, easy to learn yet powerful programming language. Guido van Rossum created Python and released in 1991. Python is so simple as there are no type declarations of variables, parameters, functions in the code, which makes the code short and flexible. In simple words, we can say Python drives the current world software development by providing libraries for technologies like data science, machine learning, artificial intelligence, etc.
Before getting our hands dirty, let’s install Python.
Step 1: Download Python for the official Python site https://www.python.org/downloads/
Download the .exe file, which is suitable for your operating system (Windows, Mac, Linux..)
Step 2: Once the download completes, run the installer by selecting the “Install Now” and check the “Add Python 3.7 to PATH” option
This installs Python with all the pre-defined options.
Step 3: Once after the installation completes you will get the completion message saying Setup was Successful, then click the Close button to complete the installation
Step 4: To confirm Python is properly installed, launch a Command Prompt window (run cmd.exe) and enter the command python -V
We should be getting the version of the Python
Note: In python – V [ V is Captial]
Python Hello World Program
Python installation comes two interactive shells.
- IDLE – Python GUI ( Integrated Development Environment)
- Python Command Line
We can use both the interactive shells for running simple programs.
Let’s use the interactive shell to write our first Python Hello World Program.
From the Start Menu –> Python 3.8 –> Click on IDLE, enter the following code, and press enter.
This produces the following output:
Hurray!! you have written your first Hello World program in Python.
With Python Command Line – Python Hello World
From the Start Menu –> Python 3.8 –> Click on Python, enter the following code and press enter
Though the interactive shell can run simple programs. Interactive mode is mostly used to test snippets of code, and for debugging code, in real-time we will be using some python editors like Anaconda, PyCharm, etc… or even you can use any text editors like Sublime Text or Notepad++
I am a huge fan of Sublime Text, let’s see how to write our Hello World program in a text editor.
- Open Sublime Text and create a new file.
- In the new file, type the following:
- Save the file as hello.py
- Open the command prompt and traverse to the folder where your file is located and execute the command python hello.py
Leave a Reply