Python 3 programming language. Python programming language for beginners. Using the POST Method

It's worth learning the language Python programming? After all, you can often hear that this language is dying. Quora users discussed this issue and shared their opinions.

Bill Carven, SQL developer, consultant, trainer and author

Assembly language gives you a great opportunity to write compact, efficient, and project-optimized code. In code written in this language, which takes up only a few kilobytes, you can do amazing things. But the level of efficiency that can be achieved using assembly language does not justify extra work, the extra time and the skills it requires.

It is true that languages ​​rise and fall in popularity. Productivity is here the main task in programming, so new languages ​​are created from time to time that increase productivity for at least some types of work.

Most programmers today use higher-level languages ​​- they need to be more productive. Languages top level can compile to machine code(C or C++), or can be compiled into bytecode with an independent architecture and run in virtual machine(Java) or be processed (JavaScript, PHP, Ruby, Python, Perl, etc.).

It is a misconception that you need to learn assembly language because “it better than Python" This is a stupid point of view based on outdated data.

Bill Poucher, Executive Director ICPC, software in the fields of energy, synthetic genetics, etc.

Learn Python. Provide yourself with programming experience. This language has its own elegance.

Learn C as a language for Unix machines. Understanding UNIX is relatively easy.

Learn MIX to understand Knuth.

Learn Java so you don't have to worry about working with others and also learn object-oriented programming.

Learn C++ so you can program in any style you want. Its strength is that it is a basic programming language. Its weakness is that in order to program in it you need to understand its style.

Learn LISP to strengthen your understanding of recursion.

Did I say that it’s not worth learning at least something? No. Because the only thing you have to do is train yourself to constant study anything, especially learning how problems can be solved.

Shiva Shinde, Python is easy to code but hard to read

The Python programming language is not dying; it is one of the fastest growing languages.

  1. It's easy to learn
  • On this moment 8 of the top 10 US computer programs use this language (Philip Guo, CACM)
  • Python programs tend to have a minimum of templates that are commonly found in other programming languages. Therefore, you can use non-standard solutions to problems more often.
  • If you have programming experience, even if not in this language, then you will quickly master Python.

2. Full functionality

  • It's not just a language for statistics. Python has all the capabilities for data collection and cleaning, database and high-performance computing, and much more.
  • This is a generally accepted programming language with a huge number of built-in libraries. It is good for data and database management and for working with network programming. It's a thoughtful language with a huge amount of resources available.

3. Serious scientific data libraries

  • Python has significant scientific libraries with a huge amount of data to use.
  • The basis of these scientific libraries is the SciPy Ecosystem, which even hosts its own conferences.
  • Pandas and Matplotlib are components of SciPy. They provide excellent data on the most different topics, for example, machine learning, predictive analysis text and network analysis.

Hernan Soulages, pragmatic programmer

This language is quite popular, its importance is growing in academic circles. It's also true that the usefulness of a programming language depends on what you want to do with it.

I don't like PHP at all, but I'm not stupid enough to deny its versatility and power, and that it's an easy language to learn.
As for learning assembly language, this language directly depends on what processor you are working with.

If you know how to work with one, then you can definitely use it in your processor family for some time. But over time, they also undergo some changes. In this sense, it is the least durable family of languages.

Magnus Lychka, developer software and consultant in Gothenburg

Many users like Python. For some applications it will be too slow, and, for example, they will work faster with assembly language, but these applications will work just as quickly in C, despite the fact that code written in C will work on any platform.

Many startups became successful with Python, after which they had to rewrite some programs in Java, C++ or C. And if these startups started working with assembly language, then most likely they would have run out of funding long before their very fast but difficult to read code would be complete.

But when working with assembly language, you will have to deal not only with different architectures processor, but also with technical details that differ from one operating systems Oh.

Since I started teaching Python in 2011, I have found several resources that I use regularly. When I first started learning the language, I was surprised at how welcoming the Python community was. The proof of this is great amount free high quality materials. Below I will give examples of those resources that simply would not exist without the support of the community.

1. Invent Your Own Computer Games With Python

You may already have your favorite Python book, but I encourage you to read this one. You can purchase it, read it online, or download it for free in PDF. I like the same structure of the chapters: first the problem is posed, and then there are examples of solutions to problems with detailed explanations. The same author wrote 3 more wonderful books.

2. Skulpt

I've worked in schools where for one reason or another (usually security reasons) Python was not available. Skulpt runs Python scripts in the browser and includes several examples. The first one uses the Turtle module to output geometric shapes. I often use it to test students' knowledge.

3. Guess the number

8. Random

Python has several useful built-in functions, such as print and input. The random module, on the other hand, needs to be imported before use. It allows students to add a little unpredictability to their projects.

Import random coin = [‘heads’,’tails’] flip = random.choice(coin) print(flip)

9.Anti Gravity

I rarely use the anti gravity module. But when I have to do this, I ask the students what will happen when they import it. Usually I get many different answers, sometimes they even suggest that the real effect of weightlessness will begin - they think that Python is so powerful :) You can try it yourself and offer it to your students.

Import antigravity

10. Sabotage

The biggest difficulty for me as a teacher was finding syntax errors in student programs. Luckily, before I completely burned out from exhaustion, I came up with

August 27, 2012 at 03:18 pm

Learn Python efficiently

  • Python

Hello everyone!

Human-readable syntax, easy to learn, high level language Object-Oriented Programming Language (OOP), powerful, interactive mode, a lot of libraries. Many other advantages... And it's all in one language.
First, let's dive into the possibilities and find out what Python can do?

Why do I need your Python?

Many new programmers ask similar questions. It's like buying a phone, tell me why should I buy this phone and not this one?
Software quality
For many, including me, the main advantages are the human-readable syntax. Not many languages ​​can boast of it. Python code is easier to read, which means reusing and maintaining it is much easier than using program code in other scripting languages. Python contains the most modern mechanisms for reusing program code, which is OOP.
Support Libraries
Python comes with a large number of compiled and portable functionality, known as standard library. This library provides you with a lot of features that are in demand in application programs, starting from searching for text using a template and ending with network functions. Python allows expansion both at the expense of your own libraries, and at the expense of libraries created by other developers.
Program portability
Most Python programs run unchanged on all major platforms. Transferring program code from Linux to Windows involves simple copying program files from one machine to another. Python also gives you a lot of opportunities to create portable graphical interfaces.
Development speed
Compared to compiled or strongly typed languages ​​such as C, C++ or Java, Python increases developer productivity many times over. Python code is typically one-third or even one-fifth the size of equivalent C++ or Java code, which means less typing, less debugging time, and less maintenance effort. Additionally, Python programs run immediately without the time-consuming compilation and linking steps required in some other programming languages, further increasing programmer productivity.

Where is Python used?

  • Google uses Python in its search engine and pays for the work of the creator of Python - Guido van Rossum
  • Companies such as Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm and IBM use Python for hardware testing
  • YouTube video sharing service to a large extent implemented in Python
  • NSA uses Python for encryption and intelligence analysis
  • JPMorgan Chase, UBS, Getco and Citadel use Python for financial market forecasting
  • The popular BitTorrent program for exchanging files on peer-to-peer networks is written in Python
  • Popular web framework App Engine from Google uses Python as an application programming language
  • NASA, Los Alamos, JPL, and Fermilab use Python for scientific computing.
and other companies also use this language.

Literature

So we got to know the Python programming language better. We can say separately that the advantages of Python are that it has a lot of high-quality literature. Not every language can boast of this. For example, language JavaScript programming cannot please users with a lot of literature, although the language is really good.

Here are sources that will help you get to know Python better, and maybe become the future Guido van Rossum.
* Some sources may be in English. You shouldn’t be surprised by this, now a lot of excellent literature is written in English language. And for programming itself you need to know at least basic knowledge of English.

I highly recommend reading the book first - Mark Lutz. Learning Python, 4th Edition. The book has been translated into Russian, so don’t be afraid if you suddenly don’t know English. But it is the fourth edition.

For those who know English, you can read the documentation on the official Python website. Everything is described there quite clearly.

And if you prefer information from video, then I can recommend lessons from Google, taught by Nick Parlante, a student from Stanford. Six video lectures on YouTube. But there is a drop of ointment in the barrel of ointment... He conducts it in English with English subtitles. But I hope that this will stop a few.

What should I do if I read books, but don’t know how to apply the knowledge?

Don't panic!
I recommend reading the book by Mark Lutz. Python Programming (4th Edition). Previously it was “studying”, but here it is “Programming”. In “Learning” - you gain knowledge of Python, in “Programming” - Mark teaches you how to apply it in your future programs. The book is very useful. And I think one is enough for you.

I want practice!

Easily.
Above I wrote about video lectures from Nick Parlante on YouTube, but they also have some

Introduction


Due to what is currently observed rapid development personal computing technology, there is a gradual change in the requirements for programming languages. Interpreted languages ​​are beginning to play an increasingly important role as the growing power personal computers begins to provide sufficient speed of execution of interpreted programs. And the only significant advantage of compiled programming languages ​​is the high speed code. When program execution speed is not a critical value, the most the right choice there will be an interpreted language as a simpler and more flexible programming tool.

In this regard, it is of some interest to consider the relatively new programming language Python (Python), which was created by its author Guido van Rossum in the early 90s.

General information about Python. Advantages and disadvantages


Python is an interpreted, natively object-oriented programming language. It is extremely simple and contains a small number of keywords, but is also very flexible and expressive. This is a higher-level language than Pascal, C++ and, of course, C, which is achieved mainly through built-in high-level data structures (lists, dictionaries, tuples).

Advantages of language.
An undoubted advantage is that the Python interpreter is implemented on almost all platforms and operating systems. The first such language was C, but its data types are different cars could occupy different amounts of memory and this served as some obstacle to writing a truly portable program. Python does not have such a disadvantage.

The next important feature is the extensibility of the language; great importance is attached to this and, as the author himself writes, the language was conceived precisely as extensible. This means that it is possible for all interested programmers to improve the language. The interpreter is written in C and source available for any manipulation. If necessary, you can insert it into your program and use it as a built-in shell. Or, by writing your own additions to Python in C and compiling the program, you can get an “extended” interpreter with new capabilities.

The next advantage is the presence large number modules connected to the program that provide various additional features. Such modules are written in C and Python itself and can be developed by all sufficiently qualified programmers. Examples include the following modules:

  • Numerical Python - advanced mathematical capabilities such as manipulation of integer vectors and matrices;
  • Tkinter - building applications using a graphical user interface (GUI) based on the Tk interface widely used on X-Windows;
  • OpenGL - using an extensive library graphic modeling two- and three-dimensional objects Open Graphics Library from Silicon Graphics Inc. This standard is supported, among other things, in such common operating systems as Microsoft Windows 95 OSR 2, 98 and Windows NT 4.0.
Disadvantages of language.
The only drawback noticed by the author is the relatively low execution speed of the Python program, which is due to its interpretability. However, in our opinion, this is more than compensated by the advantages of the language when writing programs that are not very critical to execution speed.

Features Overview


1. Python, unlike many languages ​​(Pascal, C++, Java, etc.), does not require variable declarations. They are created at the place where they are initialized, i.e. the first time a variable is assigned a value. This means that the type of a variable is determined by the type of the assigned value. In this respect, Python resembles Basic.
The type of a variable is not immutable. Any assignment to it is correct and this only leads to the fact that the type of the variable becomes the type of the new assigned value.

2. In languages ​​such as Pascal, C, C++, organizing lists presented some difficulties. To implement them, one had to thoroughly study the principles of working with pointers and dynamic memory. And even with good qualifications, the programmer, each time re-implementing the mechanisms for creating, working and destroying lists, could easily make subtle errors. In view of this, some tools have been created for working with lists. For example, Delphi Pascal has a TList class that implements lists; The STL (Standard Template Library) library has been developed for C++, containing structures such as vectors, lists, sets, dictionaries, stacks and queues. However, such facilities are not available in all languages ​​and their implementations.

One of distinctive features Python is the presence of such structures built into the language itself as tuples(tuple) lists(list) and dictionaries(dictionary), which are sometimes called cards(map). Let's take a closer look at them.

  1. Tuple . It is somewhat reminiscent of an array: it consists of elements and has a strictly defined length. Elements can be any values ​​- simple constants or objects. Unlike an array, the elements of a tuple are not necessarily homogeneous. And what distinguishes a tuple from a list is that a tuple cannot be changed, i.e. we cannot assign something new to the i-th tuple element and cannot add new elements. Thus, a tuple can be called a constant list. Syntactically, a tuple is specified by listing all elements separated by commas, all enclosed in parentheses:

  2. (1, 2, 5, 8)
    (3.14, ‘string’, -4)
    All elements are indexed from scratch. To get the i-th element, you must specify the tuple name followed by the index i in square brackets. Example:
    t = (0, 1, 2, 3, 4)
    print t, t[-1], t[-3]
    Result: 0 4 2
    Thus, a tuple could be called a constant vector if its elements were always homogeneous.
  3. List . A good, private example of a list is the Turbo Pascal language string. The elements of a line are single characters, its length is not fixed, it is possible to delete elements or, on the contrary, insert them anywhere in the line. The elements of the list can be arbitrary objects, not necessarily of the same type. To create a list, just list its elements separated by commas, enclosing them all in square brackets:


  4. ['string', (0,1,8), ]
    Unlike a tuple, lists can be modified as desired. Access to elements is carried out in the same way as in tuples. Example:
    l = ]
    print l, l, l[-2], l[-1]
    Result: 1 s (2.8) 0
  5. Dictionary . It is reminiscent of the record type in Pascal or the structure type in C. However, instead of the “record field” - “value” scheme, “key” - “value” is used here. A dictionary is a collection of key-value pairs. Here the “key” is a constant of any type (but strings are mainly used), it serves to name (index) some corresponding value (which can be changed).

  6. A dictionary is created by listing its elements (key-value pairs separated by a colon), separated by commas, and enclosing them all in curly braces. To gain access to a certain value, after the dictionary name, write the corresponding key in square brackets. Example:
    d = ("a": 1, "b": 3, 5: 3.14, "name": "John")
    d["b"] = d
    print d["a"], d["b"], d, d["name"]
    Result: 1 3.14 3.14 John
    To add a new key-value pair, simply assign the corresponding value to the element with the new key:
    d["new"] = "new value"
    print d
    Result: ("a":1, "b":3, 5:3.14, "name":"John", "new":"new value")

3. Python, unlike Pascal, C, C++, does not support working with pointers, dynamic memory and address arithmetic. In this way it is similar to Java. As you know, pointers are a source of subtle errors, and working with them relates more to low-level programming. To provide greater reliability and simplicity, they were not included in Python.

4. One of the features of Python is how one variable is assigned to another, i.e. when on either side of the operator" = " there are variables.

Following Timothy Budd (), we will call pointer semantics the case when the assignment only leads to the assignment of a reference (pointer), i.e. the new variable becomes just another name, denoting the same memory location as the old variable. In this case, changing the value denoted by the new variable will lead to a change in the value of the old one, because they actually mean the same thing.

When an assignment leads to the creation of a new object (here an object - in the sense of a piece of memory for storing a value of some type) and copying the contents of the assigned variable into it, we call this case copy semantics. Thus, if copy semantics applies when copying, then the variables on either side of the "=" sign will mean two independent objects with the same content. And here, a subsequent change in one variable will not affect the other in any way.

Assignment in Python works like this: if assignable the object is an instance of such types as numbers or strings, then copy semantics applies, but if on the right side there is an instance of a class, list, dictionary or tuple, then pointer semantics applies. Example:
a = 2; b = a; b = 3
print "copy semantics: a=", a, "b=", b
a = ; b = a; b = 3
print "pointer semantics: a=", a, "b=", b
Result:
copy semantics: a= 2 b= 3
pointer semantics: a= b=

For those of you who want to know what's going on here, I'll give you a different take on assignment in Python. If in languages ​​such as Basic, Pascal, C/C++ we dealt with “capacity” variables and constants stored in them (numeric, symbolic, string - it doesn’t matter), and the assignment operation meant “entering” the constant into the assigned variable , then in Python we must already work with “name” variables and the objects they name. (Notice some analogies with Prolog?) What is an object in Python? This is everything that can be given a name: numbers, strings, lists, dictionaries, class instances (which in Object Pascal are called objects), the classes themselves (!), functions, modules, etc. So, when assigning a variable to a certain object, the variable becomes its “name”, and the object can have as many such “names” as desired and they are all independent of each other.

Now, objects are divided into modifiable (mutable) and immutable. Mutable - those that can change their “internal content”, for example, lists, dictionaries, class instances. And unchangeable ones - such as numbers, tuples, strings (yes, strings too; you can assign a new string obtained from the old one to a variable, but the old line modification will not work).

So, if we write a = ; b = a; b = 3, Python interprets it like this:

  • give the object a "list" " Name a ;
  • give this object another name - b ;
  • modify the null element of an object.

  • This is how we get the “pseudo” semantics of pointers.

    One last thing to say about this: although it is not possible to change the structure of the tuple, the mutable components it contains are still available for modification:

    T = (1, 2, , "string") t = 6 # this is not possible del t # also an error t = 0 # allowed, now the third component is a list t = "S" # error: strings are not mutable

    5. The way Python groups operators is very original. In Pascal, this is done using operator brackets begin-end, in C, C++, Java - curly braces (), in Basic, closing endings of language constructs are used (NEXT, WEND, END IF, END SUB).
    In Python, everything is much simpler: selecting a block of statements is carried out by shifting the selected group by one or more spaces or tab characters to the right relative to the head of the structure to which the given block will belong. For example:

    if x > 0: print ‘ x > 0 ’ x = x - 8 else: print ‘ x<= 0 ’ x = 0 Thus, a good style of writing programs, which teachers of the languages ​​Pascal, C++, Java, etc. call for, is acquired here from the very beginning, since it simply won’t work any other way.

    Description of the language. Control structures



    Exception Handling


    try:
    <оператор1>
    [except[<исключение> [, <переменная>] ]:
    <оператор2>]
    [else <оператор3>]
    Performed<оператор1>, if an exception occurs<исключение>, then it is fulfilled<оператор2>. If<исключение>has a value, it is assigned<переменной>.
    Upon successful completion<оператора1>, performed<оператор3>.
    try:
    <оператор1>
    finally:
    <оператор2>
    Performed<оператор1>. If no exceptions occur, then execute<оператор2>. Otherwise executed<оператор2>and an exception is immediately raised.
    raise <исключение> [<значение>] Throws an exception<исключение>with parameter<значение>.

    Exceptions are just strings. Example:

    My_ex = ‘bad index’ try: if bad: raise my_ex, bad except my_ex, value: print ‘Error’, value

    Function Declaration



    Class Declaration



    Class cMyClass: def __init__(self, val): self.value = val # def printVal(self): print ' value = ', self.value # # end cMyClass obj = cMyClass (3.14) obj.printVal() obj.value = " string now" obj.printVal () !} Result:
    value = 3.14
    value = string now

    Operators for all types of sequences (lists, tuples, strings)


    Operators for lists (list)


    s[i] = x The i-th element s is replaced by x.
    s = t part of the elements s from i to j-1 is replaced by t (t can also be a list).
    dels removes the s part (same as s = ).
    s.append(x) adds element x to the end of s.
    s.count(x) returns the number of elements s equal to x.
    s.index(x) returns the smallest i such that s[i]==x.
    s.insert(i,j) the part of s, starting from the i-th element, is shifted to the right, and s[i] is assigned to x.
    s.remove(x) same as del s[ s.index(x) ] - removes the first element of s equal to x.
    s.reverse() writes a string in reverse order
    s.sort() sorts the list in ascending order.

    Operators for dictionaries


    File objects


    Created by a built-in function open()(see its description below). For example: f = open('mydan.dat','r').
    Methods:

    Other language elements and built-in functions


    = assignment.
    print [ < c1 > [, < c2 >]* [, ] ] displays values< c1 >, < c2 >V standard output. Places a space between arguments. If there is no comma at the end of the list of arguments, it moves to a new line.
    abs(x) returns absolute value x.
    apply( f , <аргументы>) calls function (or method) f with< аргументами >.
    chr(i) returns a one-character string with ASCII code i.
    cmp(x,y) returns negative, zero, or positive if, respectively, x<, ==, или >than y.
    divmod (a, b) returns tuple (a/b, a%b), where a/b is a div b (the integer part of the division result), a%b is a mod b (the remainder of the division).
    eval(s)
    returns the object specified in s as a string. S can contain any language structure. S can also be a code object, for example: x = 1 ; incr_x = eval("x+1") .
    float(x) returns a real value equal to the number x.
    hex(x) returns a string containing the hexadecimal representation of x.
    input(<строка>) displays<строку>, reads and returns a value from standard input.
    int(x) returns the integer value of x.
    len(s) returns the length (number of elements) of an object.
    long(x) returns a long integer value x.
    max(s), min(s) return the largest and smallest element of the sequence s (that is, s is a string, list, or tuple).
    oct(x) returns a string containing a representation of the number x.
    open(<имя файла>, <режим>='r' ) returns a file object opened for reading.<режим>= 'w' - opening for writing.
    ord(c) returns the ASCII code of a character (string of length 1) c.
    pow(x, y) returns the value of x to the power of y.
    range (<начало>, <конец>, <шаг>) returns a list of integers greater than or equal to<начало>and less than<конец>, generated with a given<шагом>.
    raw_input( [ <текст> ] ) displays<текст>to standard output and reads a string from standard input.
    round (x, n=0) returns real x rounded to the nth decimal place.
    str(<объект>) returns a string representation<объекта>.
    type(<объект>) returns the type of the object.
    For example: if type(x) == type(‘’): print ‘ this is a string ’
    xrange(<начало>, <конец>, <шаг>) is similar to range, but only simulates a list without creating one. Used in a for loop.

    Special functions for working with lists


    filter (<функция>, <список>) returns a list of those elements<спиcка>, for which<функция>takes the value "true".
    map(<функция>, <список>) applies<функцию>to each element<списка>and returns a list of results.
    reduce ( f , <список>,
    [, <начальное значение> ] )
    returns the value obtained by "reduction"<списка>function f. This means that there is some internal variable p that is initialized<начальным значением>, then, for each element<списка>, the function f is called with two parameters: p and the element<списка>. The result returned by f is assigned to p. After going through everything<списка>reduce returns p.
    Using this function you can, for example, calculate the sum of the elements of a list: def func (red, el): return red+el sum = reduce (func, , 0) # now sum == 15
    lambda [<список параметров>] : <выражение> An "anonymous" function that does not have a name and is written where it is called. Accepts the parameters specified in<списке параметров>, and returns the value<выражения>. Used for filter, reduce, map. For example: >>>print filter (lambda x: x>3, ) >>>print map (lambda x: x*2, ) >>>p=reduce (lambda r, x: r*x, , 1) >>> print p 24

    Importing Modules



    Standard math module


    Variables: pi, e.
    Functions(similar to C language functions):

    acos(x) cosh(x) ldexp(x,y) sqrt(x)
    asin(x) exp(x) log(x) tan(x)
    atan(x) fabs(x) sinh(x) frexp(x)
    atan2(x,y) floor(x) pow(x,y) modf(x)
    ceil(x) fmod(x,y) sin(x)
    cos(x) log10(x) tanh(x)

    string module


    Functions:

    Conclusion


    Due to the simplicity and flexibility of the Python language, it can be recommended to users (mathematicians, physicists, economists, etc.) who are not programmers, but use computer technology and programming in my work.
    Programs in Python are developed on average one and a half to two (and sometimes two to three) times faster than in compiled languages ​​(C, C++, Pascal). Therefore, the language may be of great interest to professional programmers who develop applications that are not critical to execution speed, as well as programs that use complex data structures. In particular, Python has proven itself well in developing programs for working with graphs and generating trees.

    Literature


    1. Budd T. Object-oriented programming. - St. Petersburg: Peter, 1997.
    2. Guido van Rossum. Python Tutorial. (www.python.org)
    3. Chris Hoffman. A Python Quick Reference. (www.python.org)
    4. Guido van Rossum. Python Library Reference. (www.python.org)
    5. Guido van Rossum. Python Reference Manual. (www.python.org)
    6. Guido van Rossum. Python programming workshop. (http://sultan.da.ru)

    Last update: 01/24/2018

    Python is a popular high-level programming language that is designed for creating various types of applications. These include web applications, games, and desktop programs, and working with databases. Python has become quite widespread in the field of machine learning and artificial intelligence research.

    First Python language was announced in 1991 by Dutch developer Guido Van Rossum. Since then, this language has come a long way in development. In 2000, version 2.0 was published, and in 2008, version 3.0. Despite the seemingly large gaps between versions, subversions are constantly being released. So, the current current version at the time of writing this material is 3.7. More detailed information about all releases, versions and language changes, as well as the interpreters themselves and necessary utilities for work and other useful information can be found on the official website https://www.python.org/.

    Main features of the Python programming language:

    Python is a very simple programming language; it has a concise and at the same time quite simple and understandable syntax. Accordingly, it is easy to learn, and in fact this is one of the reasons why it is one of the most popular programming languages ​​specifically for learning. In particular, in 2014 it was recognized as the most popular programming language for learning in the United States.

    Python is also popular not only in the field of education, but in writing specific programs, including commercial ones. This is largely why many libraries have been written for this language that we can use.

    In addition, this programming language has a very large community; you can find it on the Internet at given language a bunch of useful materials, examples, get qualified help from specialists.

    To create programs in Python, we need an interpreter. For his installations let's move on to the website https://www.python.org/ and on the main page in the Downloads section we will find the download link latest version language (currently 3.7.2):

    Let's follow the link to the page describing the latest version of the language. Closer to the bottom you can find a list of distributions for different operating systems. Let's select the package we need and download it. For example, in my case it is Windows 64-bit, so I select the package link Windows x86-64 executable installer. After downloading the distribution, install it.

    Accordingly, for MacOS you can select macOS 64-bit installer.

    On Windows OS, when you start the installer, the installation wizard window opens:

    Here we can set the path where the interpreter will be installed. Let's leave it as default, that is C:\Users\[username]\AppData\Local\Programs\Python\Python36\.

    In addition, at the very bottom, check the “Add Python 3.6 to PATH” checkbox to add the path to the interpreter to the environment variables.

    After installation, we can find icons for accessing various Python utilities in the Start menu on Windows OS:

    Here the Python 3.7 (64-bit) utility provides an interpreter in which we can run the script. IN file system The interpreter file itself can be found along the path where the installation was carried out. On Windows this is the default path C:\Users\[username]\AppData\Local\Programs\Python\Python37, and the interpreter itself represents the file python.exe. On OS Linux installation produced on the path /usr/local/bin/python3.7 .