Introduction to Python

Python is an interpreted programming language, this means that as a programmer you write Python (.py) files in a IDE (like Spyder) or Text editor (such as Notepad++) and then put those files into the python interpreter to be executed.

OPTION 1:

As already mentioned, Python codes are written here using Spyder IDE, which is part of the open-source software platform named Anaconda. Anaconda includes Python, Spyder, IPython and various other data analysis libraries. So, I would recommend you to download Anaconda from www.anaconda.com and then install it in your MS Windows PC. Setting the value of the PATH environment variable is optional here.

I have written a small Python code named test.py (just one of line code to print some message with print() function) in the editor of Spyder IDE. See the code here:

print("Hi from techguruspeaks.com!")

After executing the program, the status of different sections of the Spyder IDE is given below.

Figure 1: How to run a Python program using Spyder

OPTION 2:

Alternatively, you can also download the Python installer from www.python.org and add the installation directory to your PATH environment variable (mandatory). In this case, to check if you have python installed on a Windows PC, run the following on the command line (‘$’ indicates prompt here):

$ python --version

Now, open your command line, navigate to the directory where you saved your program, and then run on the command line:

$ python test.py

The output would be like this:

Hi from techguruspeaks.com!

Hope you are now feeling excited to run your first Python program.