Intro to Python
Last updated on September 06, 2020
Python is a high level, general purpose programming created by Guido Van Rossum. It was publicly released in 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 its simplicity and readability.
Features of Python #
Python is Easy #
Python is one of the easiest languages to get started with. Programs written in Python looks very much like the English language. Because of its simplicity, most entry-level programming courses use Python to introduce programming concepts to their students.
Python is Portable/Platform Independent #
Python is portable which means we can run Python programs in the 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 a high-level language to machine language:
- Compiler
- Interpreter
Compiler #
A compiler translates the entire source code into machine language in one go, the machine language is then executed.
Interpreter #
An interpreter, on the other hand, 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.
Compiled languages like C, C++ uses a compiler to translate the high-level code to machine language, while an interpreted language like Python uses an interpreter to translate the 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 languages because they convert data from one type to another type freely. Consider the following JavaScript code:
1 2 3 | 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 convert 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 the following kinds of applications:
- Web applications
- Android applications
- GUI applications
- Games
- Scientific applications
- System administration applications
- Console applications
and the list goes on ...
Who uses Python? #
The following is a small list of well-known Companies who use Python:
- Dropbox
- Disqus
- Quora
- Mozilla
- Youtube
I think that would be enough to impress you.
In the next lesson, we will learn how to install Python.
Note: The source code of this tutorial is available at https://github.com/overiq/intro-to-python.
Load Comments