This is the first of many articles on Python Fundamentals for Everyone, a python tutorial series which focuses on python fundamentals.
At the end of this article you will have knowledge on how to run a python program from your system.
Introduction to Python
Python is a programming language which was developed by Guido van Rossum in the year 1991 for the public distribution at the National Research Institute for Mathematics and Computer Science in Netherlands.
It is free open source software, in layman terms it means that, a piece of code which is publicly accessible — so anyone can view, modify and distribute the code as they see fit.
Python is easy to learn, easy to read, platform independent, object oriented and supports interface with major databases.
Python is an interpreted language, which means that the interpreter runs the python program as soon as we type it in or load in the system. If there exists an error then, it raises an exception and prints the error.
Let’s see how a python program runs
Python can be programmed in two ways:
- Interactive Mode Programming
- Script Mode Programming
Interactive Mode Programming
Here, we call the python interpreter on command prompt. Command Prompt is the command line interface that interacts with the user.
To open Command Prompt in windows OS, click on the start button, select run and type cmd.
If python is already installed in your system then type “python” in Command Prompt (cmd) and press enter to open python command line on cmd.
Type the following code in command line:
>>> print (“Hello World”)
Script Mode Programming
In this mode, the interpreter is invoked with a python script. Python script is nothing but some python code written in an editor for instance notepad, and saved with .py extension, for example, hello.py
So, open an editor like notepad and type the code, for example
print (“Hello World”)
And save the file with .py extension. In this case hello.py
Now, run the script by opening the command prompt and traversing to the directory where the script is saved by typing
Congratulations on having made so far!
Now you have knowledge on the two ways through which a python program can be run in your system.
In the next article we will look at variables.