Python

Python is an interpreted, high-level and general purpose programming language. It is an open-source which make it freely usable and distributable, even for commercial use. Python was created by Guido van Rossum and first released in 1991. It supports multiple programming paradigms which are procedural, object-oriented and functional programming.

Python is used for:

  • web development (used in server-side programming),
  • desktop Application (GUIs) software development,
  • scientific and Numeric,
  • networking programming,
  • system script and game development.

The Python Package Index(PyPI) is used to hosts thousands of third-party modules for python.

Why Python?

Python is cross-platfrom programming language which work on different platforms like Windows, Mac, Linux, Raspberry Pi, etc. It has simple syntax easy to learn similar to english language. Python supports multiple programming paradigms. Python syntax allow developers to write programs in less code of lines than some other programming languages. Python is an interpreted language so that it make prototyping very quick.

Versions of Python:

  • Python 1.0 - First Release on 1991
  • Python 2.0 - It was released on 16 October 2000. This version series was most popular.
  • Python 3.0 - Released on 3rd December 2008. The Python 3.7.4 is current version series available.

Syntax:

  • Python 2 syntax:
    • print 'Hello, world!'
      raw_input('What is your name?\n')
      self.failUnlessEqual(median([2, 9, 9, 7, 9, 2, 4, 5, 8]), 7) # Unit testing with unittest
      copy[(size - 1) / 2] # access of a list index without casting to int
      xrange(BOARD_SIZE) # xrange exists
      cmp(1.0, 0.0) # cmp function exists
      iteratable.next() # list iteration
      itertools.ifilter(prime.__rmod__, iteratable) # itertools.ifilter is filter in Python 3
  • Python 3 syntax:
    • print('Hello, World!')
      input('What is your name?\n')
      self.assertEqual(median([2, 9, 9, 7, 9, 2, 4, 5, 8]), 7) # Unit testing with unittest, failUnlessEqual deprecated
      copy[int((size - 1) / 2)] # access of a list index needs casting to int
      range(BOARD_SIZE) # xrange was renamed to range in Python 3
      #cmp needs to be implemented!
      def cmp(a, b):
           return (a > b) - (a < b)
      next(iteratable) # list iteration
      filter(prime.__rmod__, iteratable) # is itertools.ifilter in Python 2

 

You Must Learn More