Python is a general-purpose interpreted, interactive, object-oriented ,Platfom independent and high-level programming language. Python was created by Guido van Rossum in the late eighties and early nineties. Python source code is also now available under the GNU General Public License (GPL).
Python is Interpreted: This means that it is processed at run time by the interpreter and we do not need to compile our program before executing it.
Python is Interactive: This means that we can actually work at python prompt and interact with the interpreter directly to write our programs.
Python is Object-Oriented: This means that Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
Python has support for functional and structured programming methods as well as OOP. It can be used as a scripting language or can be compiled to byte-code for building large applications. It has very high-level dynamic data types and supports dynamic type checking. It supports automatic garbage collection.
Programming in Python
Python program can run on any operating system since it is platform independent language.
There are three different ways to work in Python :
-
Interactive mode : We can enter python’s interactive mode by “python” in command line and write our commands.
-
Script from command line : We can first make a script using an editor e.g. Vim editor with extention ‘.py’ (e.g. Hello.py) and then run this script using command ‘python hello.py’ ( hello.py being the script name) .
-
Integrated Development Environment : We can use an IDE for python programming . IDE used in UNIX is IDLE.
Data types
Python has five standard data types :
-
Numbers : Includes signed integers, long integers , float and complex numbers .
-
Strings
-
List
-
Tuple
-
Dictionary
Operators
Like all other languages python supports a number of operators . These are :
-
Arithmetic operators
-
Comparison (i.e., Relational) Operators
-
Assignment Operators
-
Logical Operators
-
Bitwise Operators
-
Membership Operators (in , not in)
-
Identity Operators (is , is not)