Introduction to Python – What is Python?

You have decided to learn Python and we can only congratulate you. We will try to anticipate your questions and leave nothing behind.

In this chapter, we will first explain what a programming language is. We will then briefly see the story of Python so that you at least know where this language comes from! This chapter is theoretical but we urge you to read it anyway.

The final section will cover the installation of Python, an essential step to continue this tutorial. Whether you are working with Windows, Linux or Mac OS X, you will find precise explanations of the installation.

A programming language? What is it?

Python is a programming language, the first version of which was released in 1991. Created by Guido van Rossum , this language was named in tribute to the troupe of comedians “Monty Python”.

what is python 2018

What can Python do?

Python is a powerful language that is both easy to learn and rich in possibilities. From the moment you install it on your computer, you have many features built into the language that we will discover throughout this series.

It is also very easy to extend the existing features, as we will see. Thus, there are so-called libraries that help the developer to work on particular projects. Several libraries can thus be installed to, for example, develop graphical interfaces in Python.

Concretely, that’s what we can do with Python:

  • small, very simple programs, called scripts that serve a very precise mission on your computer;

  • complete programs, such as games, office suites, multimedia software

  • very complex projects, such as software packages (set of several software that can work together, mainly used in the professional world).

Here are some of the features offered by Python and its libraries:

  • create graphical interfaces;

  • circulate information through a network;

  • interact in an advanced way with your operating system;

Of course, you will not learn to do all this in minutes. But this course will give you bases broad enough to develop projects that can become, thereafter, quite important.

An interpreted programming language

Yes, you will have to wait a little longer because we have two or three things to explain to you, and we are convinced that it is important to know a minimum of these details that may seem impractical at first glance.

Python is an interpreted programming language, meaning that the instructions you send to it are “transcribed” in machine language as they are read. Other languages (such as C / C ++) are called ” compiled languages ” because, before they can be executed, specialized software is used to transform the code of the program into machine language. This step is called ” compilation “. Whenever you change the code, you must recall a compilation step.

The advantages of an interpreted language are simplicity (we do not go through a compilation step before running its program) and portability (a language such as Python is supposed to work on Windows as well as on Linux or Mac OS, and one should not have to make any change in the code to move it from one system to another). This does not mean that the compiled languages are not portable, far from it! But we must use different compilers and, from one system to another, some instructions are not compatible or behave differently.

Different versions of Python

When the Python Software Foundation was created in 2001, and in the years that followed, the Python language went through a series of versions that were included in the Python 2.x (2.3, 2.5, 2.6 …). Since February 13, 2009, version 3.0.1 is available. This version breaks the backward compatibility that prevailed in the latest versions.

The point is that a program that runs under a certain version will always work with the new version. However, the Python Software Foundation, observing a good number of obsolete features, implemented several times … decided to delete the entire project. A program that runs perfectly under Python 2.x will need to be updated to a minimum to run again under Python 3. That’s why we will advise you later to download and install the latest version of Python. I will indeed focus on the features of Python 3.

That being said, let’s move to the installation!

What is Python used for?

With Python, small programs can be developed quickly and easily. But also for big developments, Python is well suited because of its object orientation. Therefore, Python can be used as a Rapid Application Development (RAD) tool as well as a system administration scripting language.

Python has been consistently developed object-oriented from the beginning. Therefore, there are not the inconsistencies that traditional languages bring with them, which object orientation was later “grafted” on (C ++, Object Pascal, Perl). But – unlike Java or Smalltalk – no one is forced to program object-oriented. Python, like Oberon-2, is also an excellent procedural programming language.

Somehow, Python also seems to have roots in the field of artificial intelligence. Functional programming constructs that have made Lisp, Scheme or even Mathematica popular, namely, are also integrated into Python.

Install Python

Installing Python is child’s play, both on Windows and Unix systems. Whatever your operating system is, you must go to the official Python site .

Windows

    1. Click on the link Downloadin the main menu of the page.

    2. Select the version of Python you want to use (We recommend the latest one).

    3. There is one (or more) link (s) to the Windows version: select the one that will suit your processor. If in doubt, download the x86 version.

If your computer tells you it can not run the program, try another version of Python.

  1. Save and run the installation file and follow the steps. It is neither very long nor very difficult.

  2. Once the installation is complete, you can go to the start menu. Python should appear in this list the (following figure). We will see soon how to launch it, no impatience …Start>All Programs

    On Linux

    Python is pre-installed on most Linux systems. However, you may not have the latest version. To check it, type this command in the terminal: python -V. This command returns the version of Python currently installed on your system. It is very likely that it is a version 2.x , like 2.6 or 2.7, for compatibility reasons. In any case, we advise you to install Python 3.x, the syntax is very close to Python 2.x but also differs in some ways.

    Click downloadand download the latest version of Python (currently “Python 3.4 gzipped source tarball”). Open a terminal, then go to the folder where the archive is located:

    1. Uncompress the archive by typing: tar -xzf Python-3.6.0.tar.bz2(this command is of course to adapt according to the version and the type of compression).

    2. Wait a few moments for the decompression to finish, then go to the folder just created in the current directory ( Python-3.6.0in our case).

    3. Run the script configureby typing ./configurein the console.

    4. Once the configuration has taken place, you only have to compile by typing makeand then make installas superuser.

    On Mac OS X

    Download the latest version of Python. Open the file .dmgand double-click on the installation packagePython.mpkg

    An installation wizard opens, let yourself be guided: Python is now installed!

    Start Python

    Phew! That’s done!

    Well, in theory, we start using Python in the next chapter but, for you to be a little rewarded for your exemplary installation, here are the different ways to access the Python command line that we will particularly study in the next chapters.

    You have several ways to access the Python command line, the most obvious of moving through the menus. If all goes well, you should get a beautiful console (the following figure). The information displayed in yours may not be the same, but do not worry about it.StartAll ProgramsPython 3.6>Python (Command Line)what is python

    On Linux

    When you installed it on your system, Python created a link to the interpreter as python3.X (where X is the version number installed).

    On Mac OS X

    Look for a folder Pythonin the folder.Applications To launch Python, open the application IDLEfor this folder.

    Python has one of the most mature package managers: PyPI

    According to Venkatesan, once the language is assimilated, the user will be able to fully exploit the platform. Indeed, Python is supported by PyPi, a repository of over 85,000 Python modules that contain ready-to-use scripts. These modules provide functionality for your local Python environment and help you solve a variety of issues including database operations, data analysis, RESTful web services creation, and more.

    As a reminder, PyPI (“Python Package Index”) is the official third-party repository of the Python programming language. Its goal is to provide the Python developer community with a complete catalogue listing all free Python packages. It is similar to CPAN for Perl.

    Python is a language of choice, that is to say general purpose

    Python is an interpreted, interactive, object-oriented, high-level general purpose programming language. According to engineer Venkatesan, Python is today the most popular programming language. Developers today have the flexibility to make Python their preferred language in almost every area of computing, including Web development, cloud computing (AWS, OpenStack, VMware, Google Cloud, etc.), automation, software testing, Big Data, Hadoop, etc.

    Python allows you to create more functions with fewer lines of code

    Python allows developers to create functions with fewer lines of code, which would not be the case with other programming languages. It is an easy language to learn and with practice, it becomes possible to quickly create a rudimentary game in two days. Another factor that makes Python an interesting programming language for novices is its readability and effectiveness.

    In summary

    • Python is an interpreted programming language, not to be confused with a compiled language.

    • It allows creating all kinds of programs, like games, software, software packages, etc.

    • It is possible to associate libraries with Python to extend its possibilities.

    • It is portable, ie it can work under different operating systems (Windows, Linux, Mac OS X, …).

     Coderoo hopes this post has been able to give an answer to question “What is Python” – it is a complex question and can be answered in many different ways.

Leave a Reply