What is Python?
- Python tutorial provides basic and advanced concepts of Python. Our Python tutorial is designed for beginners and professionals.
- Python is a simple, easy to learn, powerful, high level and object-oriented programming language.
- Python is an interpreted scripting language also. Guido Van Rossum is known as the founder of python programming.
- Our Python tutorial includes all topics of Python Programming such as installation, control statements, Strings, Lists, Tuples, Dictionary, Modules, Exceptions, Date and Time, File I/O, Programs, etc. There are also given Python interview questions to help you better understand the Python Programming.
- Python is a general purpose, dynamic, high level and interpreted programming language. It supports Object Oriented programming approach to develop applications. It is simple and easy to learn and provides lots of high-level data structures.
- Python is easy to learn yet powerful and versatile scripting language which makes it attractive for Application Development.
- Python's syntax and dynamic typing with its interpreted nature, makes it an ideal language for scripting and rapid application development.
- Python supports multiple programming pattern, including object oriented, imperative and functional or procedural programming styles.
- Python is not intended to work on special area such as web programming. That is why it is known as multipurpose because it can be used with web, enterprise, 3D CAD etc.
- We don't need to use data types to declare variable because it is dynamically typed so we can write a=10 to assign an integer value in an integer variable.
- Python makes the development and debugging fast because there is no compilation step included in python development and edit-test-debug cycle is very fast.
Python 2 vs. Python 3In most of the programming languages, whenever a new version releases, it supports the features and syntax of the existing version of the language, therefore, it is easier for the projects built in the language to switch in the newer version. However, in the case of python, the two versions python 2 and python are very much different from each other.
The two differences which can be pointed out here is
- Python 2 uses print as a statement and used as print "something" to print some string on the console. On the other hand, Python 3 uses print as a function and used as print("something") to print something on the console.
- Python 2 uses the function raw_input() to accept the user's input. It returns the string representing the value which has typed by the user. To convert it into the integer, we need to use the int() function in python. On the other hand, Python 3 uses input() function which automatically interpreted the type of input entered by the user. However, we can cast this value to any type by using primitive functions (int(), str(), etc.).
- In python 2, the implicit string type is ASCII whereas, in python 3, the implicit string type is Unicode.
- Python 3 doesn't contain the xrange() function of python 2. The xrange() is the variant of range() function which returns a xrange object that works similar to Java iterator. The range() returns a list for example the function range(0,3) contains 0, 1, 2.
- There is also a small change made in Exception handling in python 3. It defines a keyword as which is necessary to be used. We will discuss it in Exception handling section of this tutorial.