Python

Python is used to create web and desktop applications, and some of the most popular web applications like Instagram, YouTube, Spotify all have been developed in Python. You can also develop the next big thing by using Python.

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

  • It uses an elegant syntax which makes the programs you write easier to read.
  • Comes with a large standard library that supports many common programming tasks such as connecting to web servers, searching text with regular expressions, reading modifying files.
  • Easily extended by adding new modules implemented in a compiled language such as C or C++.
  • Python’s interactive mode makes it easy to test short snippets of code.

  • Python was designed for readability, and has some similarities to the English language with influence from mathematics.
  • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
  • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.

Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. Python uses indentation to indicate a block of code.

Comments start with “#”, and Python will render the rest of the line as a comment.

  • Text type:
str
  • Numeric types:
int, float, complex
  • Sequence types:
list, tuple, range
  • Mapping type:
dict
  • Set types:
set, frozenset
  • Boolean type:
bool
  • Binary types:
bytes, bytearray, memoryview

Python 2 made code development process easier than earlier versions. It implemented technical details of Python Enhancement Proposal (PEP). Python 2.7 (last version in 2.x ) is no longer under development and in 2020 will be discontinued.

On December 2008, Python released version 3.0. This version was mainly released to fix problems which exist in Python 2. The nature of these change is such that Python 3 was incompatible with Python 2. It is backward incompatible Some features of Python 3 have been backported to Python 2.x versions to make the migration process easy in Python 3.

  • Python 3 syntax is simpler and easily understandable whereas Python 2 syntax is comparatively difficult to understand.
  • Python 3 default storing of strings is Unicode whereas Python 2 stores need to define Unicode string value with "u."
  • Python 3 value of variables never changes whereas in Python 2 value of the global variable will be changed while using it inside for-loop.
  • Python 3 exceptions should be enclosed in parenthesis while Python 2 exceptions should be enclosed in notations.
  • Python 3 rules of ordering comparisons are simplified whereas Python 2 rules of ordering comparison are complex.
  • Python 3 offers Range() function to perform iterations whereas, In Python 2, the xrange() is used for iterations.

A dictionary is a collection which is unordered, changeable and indexed. In Python dictionaries are written with curly brackets, and they have keys and values.