Python is a high-level, general-purpose, interpreted, dynamic programming language. It was created by Guido van Rossum during 1985- 1990. There are two versions of Python available: 2.7 and 3.3. This course will cover 2.7 Version. Of course, if you wish then you can download and use 3.3 Version.
Features of Python
- Clearly defined and readable since it uses English keywords, simple structure, and a clearly defined syntax (human-like language and NOT machine-level).
- Python is processed at the runtime by the Interpreter. There is no need to compile your python program before executing it.
- Python supports Object-Oriented technique of programming that encapsulates code within objects.
- Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
- Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems.
- It can be used as a scripting language or can be compiled to byte-code for building large applications.
- It supports automatic garbage collection.
It has numerous applications in areas such as web programming, scripting, scientific computing, image processing, Big Data and Artificial Intelligence.
So first we have to download and install python. I am demonstrating with the help of Windows.
Go to https://www.python.org/ and download it based on your OS.
Click the downloaded .msi file and follow the screenshots.
In this stage, you need to select Will be installed on local hard drive. This will set your path.
Once installed, the python console can be accessed using command line by invoking the Python interpreter directly or best way is running GUI that comes installed with Python called IDLE. If you need to check whether you have successfully installed it or not, then open IDLE, you will see a prompt of 3 right arrows. Type in print ‘hello world’, then hit enter. No need to write semicolon like you do in C or C++. You will see something like this:
If you don’t see this, then you have done wrong somewhere. Go to Control Panel> Programs> Uninstall Programs and uninstall python. Then if you keep your default drive C while installing, go there and delete Python27 file. Then start installing it again.
- After going to the website, follow the link to download zipped source code available for Unix/Linux.
- Download and extract files.
- Editing the Modules/Setup file if you want to customize some options.
- run ./configure script
- make install
This installs Python at standard location /usr/local/bin and its libraries at /usr/local/lib/pythonXX where XX is the version of Python.
Setup path in Linux:
- In the csh shell− type setenv PATH “$PATH:/usr/local/bin/python” and press Enter.
- In the bash shell (Linux)− type export PATH=”$PATH:/usr/local/bin/python” and press Enter.
See http://www.python.org/download/mac/ for instructions on getting the current version along with extra tools to support development on the Mac. In Mac OS, the installer handles the path details.
So that’s it for today. I hope you have liked your first tutorial. See you in the next one. Peace. 🙂