Short Tutorial: Introduction to Python
Python is a high-level programming language created by Guido Van Rossum in 1989. Python is very popular among programmers and testers as it is straightforward to learn and use to automate any repetitive IT task very easily. In this article, we will discuss Python2 and Python3, how we can switch between them, the advantages of Python, and the first program in Python.
Python2 or Python3
Python 2.7 was released in mid-2010 and Python 3.x was released in 2008. As Python 3.x is not backward compatible, programs written in Python 2.x not working in Python 3.x. Most of the tools/ libraries still do not support Python 3.x. Hence, Python 2.x is widely used by the tech community. But no doubt, eventually Python 3.x come into the picture in a couple of years.
You can switch between different versions of python by using the below commands:
For more information: https://wiki.python.org/moin/Python2orPython3
Advantages of Python
(1) Python is a high-level, open-source, and easy-to-use language.
(2) Python language is supported by different operating systems such as Unix/Linux (preloaded), Mac OS (preloaded), Windows, Embedded Systems, and Mobile Platforms such as Android, and iOS.
(3) Developer community widely used python for creating open-source tools.
(4) Rich set of libraries is available to do the complicated task.
(5) It is used in Rapid Prototyping and helps the development of things in a fast manner.
Implementation of Python
- Cpython: a reference implementation of "Python", written in C.
- PyPy: python in RPython. It supports Python 2.7 and it is 5 times faster than the reference implementation.
- JPython: python in Java (supports Python 2.7)
- PythonNet: python for .Net (supports Python 2.6 up to Python 3.5)
- IronPython: python in C#
First program in Python
I am using OS Ubuntu 16.04 for doing python programming. Just open Terminal, enter "python". Below example shows how to display text on the terminal by using print command.
Alternatively, you can create the program in the file with extension .py, give execute permission and run as mentioned below.
Subscribe us to receive more such articles updates in your email.
If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!
Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.