The transition from consuming games and web apps to being the one behind them is exciting. Imagine if, with one technology, you could create all that? The world would be at your fingertips. Well, what if we told you that it’s possible? 1991 changed a lot of things for the programming industry and many others. We’re talking about Python programming, a friendly general-purpose programming language. And in a world of machine learning, Python is here to stay. So let us start with Python tutorial.

 

python tutorial

 

What is Python?

Python is an object-oriented language, which means that it can model real-world objects. It is also dynamically-typed because it carries out type-checking at runtime. It does so to make sure that the type of a construct matches what we expect in that context. The distinctive feature about Python is that it is an interpreted language. The Python IDLE (Integrated Development Environment) executes instructions a line at a time.

Etymology states that Guido van Rossum named it after the comedy group Monty Python. That is why the metasyntactic variables used here are ‘spam’ and ‘eggs’ instead of ‘foo’ and ‘bar’. Unlike as expected, it does not refer to the reptile species. A lot of implementations today run version 2.x, but the future belongs to Python 3.x. It is also called ‘Python 3000’ or ‘Py3K’. CPython, written in C, is the most common implementation of Python. It compiles a Python program into intermediate bytecode.

Apart from the constructs that Python provides, you can use the PyPI (Python Package Index). It is a repository of third-party modules, you can install it using a program called pip. Run the following command in Command Prompt:

pip install library_name

Python History

Python programming language was conceived in the late 1980s and was named for the BBC TV show Monty Python’s Flying Circus. Guido van Rossum started python implementation at CWI in the Netherlands in December 1989. This was a successor to the ABC (programming language) which was capable of exception handling and interfacing with the Amoeba operating system.

On October 16, 2000, python 2.0 release was there and it had many major new features, that includes cycle-detecting garbage collector for memory management and support for Unicode.

Next version of Python 3.0 was released on December 3, 2008.

Architecture

This is the architecture of a CPython Compiler/Interpreter.

a. Parser

It uses the source code to generate an abstract syntax tree.

b. Compiler

It turns the abstract syntax tree into Python bytecode.

c. Interpreter

It executes the code line by line.

Components of Python

Functions

A function is a collection of statements named into one. You can use it when you want to execute all those statements at a time. You can call it wherever you want in a program. A function may return a value.

Classes

As we discussed, Python is an object-oriented language. It supports classes and objects. A class is an abstract data type. In other words, it is a blueprint for an object of a certain kind. It holds no values.

Modules

A Python module is a collection of related classes and functions. We have modules for mathematical calculations, string manipulations, web programming, and many more.

Packages

A package is a collection of related modules. You can either import a package or create your own.

For more learn about Features of Python

posted on 2018-03-17 20:04  PritamPal  阅读(88)  评论(0)    收藏  举报