Introduction to Python
Python is basically a high-level programming language. It is a dynamic and free open-source language in nature. Moreover, it uses an interpreter for converting the source code into machine code. Furthermore, it supports both object-oriented programming as well as procedure-oriented programming. It is such a language that is highly readable and uses English keywords.
History of Python
Guido Van Rossum developed Python in the middle of the eighties and nineties. He developed it at the National Research Institute for Mathematics and Computer Science in the Netherlands.
It is derived from many languages like C, C++, Algol-68, ABC, Unix shell, etc. Moreover, it is copyrighted.
The features are as follows:
Easy to code and maintain
Many people call it developer-friendly because it is quite easy to learn. Furthermore, we can learn to write its code very easily in a few hours or days. Moreover, this is possible because it has only a few keywords, a simple structure, and a clearly defined syntax.
Open source and free
It is an open-source language which means that anyone can download it, use it, and share it. Moreover, it is free of cost.
It supports object-oriented programming language features. For example, the concept of object and classes, encapsulation, inheritance, etc.
Supports GUI programming
Python has support for creating various GUI applications. Furthermore, these applications can work in many system software and libraries. Besides, it has modules like PyQt5, PyQt4, wxPython, or Tk through which we can make graphical user interfaces. Among them, PyQt5 is the most popular for making graphical apps.
Extensible in nature
It is extensible in nature which means that we can use python code in other languages. For example C, C++ also can compile that code in C or C++.
Portable and Platform independent
It is portable in nature. Moreover, we can run the python code in any environment like windows, Linux, mac, etc without changing it. Besides, if we write the code in one OS and run it on the other it is totally valid.
We can easily integrate it with other languages such as C, C++, etc. Hence, it is an integrated language.
It uses an interpreter for converting the source code into machine code. This means that we execute the python code line by line. Hence, it becomes easy to debug the error and solve it.
Huge Standard Library
There are a very large number of libraries in python. These libraries contain predefined modules and functions for certain tasks. Hence, it becomes easy fr the programmer to develop the code since he does not have to do all the things by himself. Moreover, the library is portable and cross-platform compatible.
This means that we do not have to define the type of the variable. The interpreter decides it itself at the run time. Hence, the name dynamically typed.
It provides good support for large programs.
Some additional features besides these are as follows:
- It supports both object-oriented and procedure-oriented programming structure.
- We can use it as a scripting language for large applications.
- It contains automatic garbage collection.
- It performs dynamic type checking.
- Case sensitive in nature.
- Useful for developing web applications.
- it uses indentation for program structuring. Unlike other languages that use braces for the distinction of blocks.
Browse more Topics Under Getting Started with Python
Execution Modes in python
As we know that python uses an interpreter for the execution of source code. now, there are two ways in which we can use the interpreter. They are as follows:
- Interactive Mode
- Script Mode
The interactive mode allows us to execute a single statement instantly. Whereas, in script mode we can write multiple lines of code and then execute it.
In this mode, we can execute a single statement at a time. Moreover, to use the interactive mode, we have to write the statement in front of ‘>>>’ and press enter. This results in the output of that particular statement immediately. This mode is easy and convenient to use to see the instant output. But, at the same time, we cannot save the whole code and have to write it again and again to execute it.
In this mode we have to write the whole source code and save it as a Python source code file. Furthermore, we can execute this file using the interpreter. Moreover, we save the python source code file with the extension ‘.py’.
Frequently Asked Questions (FAQs)
Q1. What is python?
A1. Python is basically a high-level programming language. It is a dynamic and free open-source language in nature. Moreover, it uses an interpreter for converting the source code into machine code.
Q2.Who developed python and when?
A2. Guido Van Rossum developed Python in the middle of the eighties and nineties.
Q3. Name two execution modes in python.
A3. Two execution modes are as follows:
- Interactive Mode
- Script Mode
Q4. Name some features of python.
A4. Certain features are as follows:
- Easy to code and maintain
- Open source and free
- Supports GUI programming
- Extensible in nature
- Portable and Platform independent
- Integrated Language
- Interpreted Language
- Huge Standard Library
- Dynamically Typed