Intro to Python

Python is a high level, general purpose programming created by Guido Van Rossum. It was publicly released on 1991. By high level, we mean a language which hides nitty-gritty details from the programmer. Further, It also used to refer to a Computer language which is easy to understand for humans. Python is known for known for it's simplicity and readability.

Features of Python #

Python is Easy #

Python is one of the easiest language to get started with. Programs written in Python looks very much like English language. Because of it's simplicity, most entry level programming courses uses Python to introduce programming concepts to their students.

Python is Portable/Platform Independent #

Python is portable which means we can run Python programs in various different operating system without any changes.

Python is an Interpreted Language #

Python is an Interpreted language. Languages like C, C++ are examples of compiled language.

Programs written in a high level language are called source code or source program and the commands in the source code are called statements. A computer can't execute a program written in high level language, it only understands machine language which consists of 0s and 1s only.

There are two types of programs available to us to translate high-level language to machine language:

  1. Compiler
  2. Interpreter

Compiler #

A compiler translates the entire source code into machine language in one go, the machine language is then executed.

program-execution-by-compiler.png

Interpreter #

An interpreter on the other hand, translates translates high-level language into machine language line by line, which it then executes. Python Interpreter starts at the top of the file, translates the first line into machine language and then executes it. This process keeps repeating until the end of the file is reached.

program-execution-by-interpreter.png

Compiled languages like C, C++ uses compiler to translate high level code to machine language, while interpreted language like Python uses interpreter to translate high level code to machine language.

Another important distinction between Compiled and Interpreted language is that the compiled languages perform slightly better than programs written using interpreted languages. However, I do want to point out that this advantage of Compiled languages is slowly fading away.

Python is Strongly Typed #

Strongly typed languages don't convert data from one type to another type automatically. Languages like JavaScript and PHP, are called loosely typed typed languages because they convert data from one type to another type freely. Consider the following JavaScript code:

price = 12
str = "The total price = " + 12
console.log(str)

Output:

The total price = 12

In this case, before adding 12 to the string; JavaScript first converts number 12 to string "12" and then appends it to the end of the string.

However, In Python statements like str = "The total price = " + 12 would produce an error because Python doesn't automatically converts number 12 to string.

Huge set of libraries #

Python has a huge set of libraries which makes it easy to add new capabilities without reinventing the wheel. We can access these libraries at https://pypi.python.org/pypi.

Here are two common question I hear from beginner Python programmers.

What type of application I can create using Python ? #

We can use Python to create following kinds of applications:

  1. Web applications
  2. Android applications
  3. GUI applications
  4. Games
  5. Scientific applications
  6. System administration applications
  7. Console applications

and the list goes on ...

Who uses Python ? #

The following is a small list of well known Companies who uses Python:

  1. Dropbox
  2. Disqus
  3. Reddit
  4. Quora
  5. Mozilla
  6. Google
  7. Youtube

I think that would be enough to impress you.

In the next lesson we will learn how to install Python.