- Python is a high-level, general purpose, interpreted, dynamic programming language.
- It supports multiple paradigms like Object oriented, imperative and functional programming styles.
- Python is interpreted, means processed at run time like PERL and PHP by interpreter. Hence you do not need to compile your program before executing it.
- Python was developed by Guido van Rossum at the National Research Institute for Mathematics and Computer Science in the Netherlands.
Features of Python :
- Free and Open Source
- Easily Embedded as scripting language with Other programming language.
- It is an Object Oriented programming language.
- Python is simple and easy to learn.
Installation & Environment Setup
Before going further, go to https://www.python.org/downloads/ and download Python according to your Operating System.
Installing for Windows
In this tutorial in will be using Python 3.6.1 on 64-bit Windows 7. Go to the highlighted area and
choose and download proper version. While installing Python for Windows , remember to check “Add Python.exe to path”.
After this click On Install now. This will successfully install Python on your computer.
Installing for Linux Machine
- Extract the downloaded File.
- And then run following commands
> ./configure script > make > make install
Running Python programs:
You can run python in two different ways :
- From Command Line or Terminal
- From an Integrated Development Environment (IDE).
Running from Command Line or Terminal
From Command Line also You can run in two ways: By typing commands directly in python shell and by running python program stored in a file or working directory.
By typing commands directly in python
Below picture shows a python program for Fibonacci series. Just go to your windows home and start python.
By running python program stored in a file in working directory.
Best practice is to run your programs stored in a file. So let’s create a file Test.py in your working directory using a text- editor. (eg: C:\Users\XYZ\work) , and write
Now to run the above script open the command line/terminal and change your path to current working directory. and run your python program in following fashion.
C:\Users\XYZ\work> python Test.py
You will get output as :