Environment Set-up






In this section we will cover the topics regarding setting up of Python environment in the machine.


Installing Python & Interpreter:

First of all, we need to download the appropriate interpreter for our machine. We will go with python 3.x as it is the latest version of python.For installation, we need to download the latest version of Python from its official website which link is https://www.python.org/downloads/ . Here
we check the latest available version, currently, in our case, it is "3.8.1". If anyone is interested in any other version then its downloading link is
also available on the same page. Download the installer based on the operating system and processor architecture (32 bit or 64 bit). Once it is downloaded, install it on the machine.


Python Shell and Idle:

There are two ways in which we can execute a python program. One is using Python's runtime environment and another is using the
command-line interface. The Command-line Interface is divided into two forms:

  • Regular python shell
  • IDLE (Integrated Development and Learning Environment)

A regular Python shell looks like a normal command line or terminal. On the other hand, IDLE is a python program with a regular graphical user interface (GUI). IDLE offers more menu options, customization options, and GUI functions. Also, we can customize IDLE according to our comfort.
Once the python is installed we can launch the IDLE like any other program. Below is the snapshot of the IDLE:
 idle-snap


First Test Program:

Let's start writing the first test program in python using the command line. Open the IDLE or shell and simply write the below line after the prompt
and hit enter:
>>> print("Hello! This is just a test code")
After pressing enter, the Python Interpreter responds as below:
Hello! This is just a test code
Here ">>>" is the prompt that appears in the python shell or IDLE. We need to give our instructions after this prompt. The above method is good for learning and writing the smaller programs but in the case of writing the bigger or complex professional programs we need to write the code in a separate editor and save it with .py extension so that system recognizes it as a python file type. Now, these python files can be easily executed from
the command line just by typing its file name.