Introduction to programming in Python. Python programming language. Training from scratch: features, rules and recommendations

We present to your attention a new course from the team The Codeby- "Penetration testing of Web Applications from scratch." General theory, working environment preparation, passive fuzzing and fingerprinting, Active fuzzing, Vulnerabilities, Post-exploitation, Tools, Social Engeneering and much more.


Python programming language has long taken a leading place among all programming languages. In terms of the number of areas of application and capabilities, it competes with languages ​​such as C++ and JavaScript. Of course, Python is much younger than classical programming languages, but it is ideal for beginners and beyond. Python is used in such large companies as Pixar, NASA.

Firstly: This programming language has dynamic typing, which means there is no need to declare the type of variables, cast one type to another, and think about any restrictions on the number of characters contained in these variables. Dynamic typing makes it easier for beginners because they don't have to delve deeply into the RAM and CPU to understand how the language works. Of course, there are rules that explain some of the principles of casting one data type to another. These are, of course, worth paying attention to when learning Python: this way you can avoid logical errors that are not recognized by the compiler.

Dynamic typing example:

Secondly: This language has powerful object-oriented programming capabilities. This means that the logical structure of a Python program can be built in such a way that its code fits into a relatively small number of lines. Indeed, programs written in Python take up one and a half to two times fewer lines than the same programs written, for example, in C++.

Python is a general purpose language. This means that it can be used in absolutely any area of ​​software development. Indeed, everything can be developed in Python: complex mathematical systems using the NumPy module (an alternative to MatLab), web applications using Django, graphical interfaces using Tkinter, games using PyGame, and so on.

The only disadvantage of this language is its low speed compared to classical languages ​​(C++, Java). On the other hand, the computing power of modern computers makes this difference invisible. However, here too, Python developers have found an ingenious solution. The CPython runtime compiles code without an intermediate machine code stage, which makes the program run faster. Thus, program modules where speed is critical can be developed using CPython.

From all of the above, it follows that Python is worth learning. If you are a beginner programmer, then feel free to choose Python as your first language. This will make it easier for you to learn the art of programming and give you the opportunity to grow in the future. To install Python on Linux, you can read

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 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 the standard library. This library provides you with a lot of features that are in demand in application programs, ranging from text search by template to network functions. Python can be extended both by your own libraries and by libraries created by other developers.
Program portability
Most Python programs run unchanged on all major platforms. Transferring program code from Linux to Windows involves simply 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 Python's creator, Guido van Rossum.
  • Companies such as Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm and IBM use Python for hardware testing
  • YouTube's video sharing service is largely 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
  • Google's popular App Engine web framework uses Python as its 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, the JavaScript programming language 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. This should not be surprising; now a lot of excellent literature is written in English. 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

(Translation)

An article was published on the Poromenos Stuff website in which, in a concise form, they talk about the basics of the Python language. I offer you a translation of this article. The translation is not literal. I tried to explain in more detail some points that may not be clear.

If you are planning to learn the Python language, but cannot find a suitable guide, then this article will be very useful to you! In a short time, you will be able to get acquainted with the basics of the Python language. Although this article often relies on you already having programming experience, I hope even beginners will find this material useful. Read each paragraph carefully. Due to the condensation of the material, some topics are discussed superficially, but contain all the necessary material.

Basic properties

Python does not require explicit declaration of variables, and is a case-sensitive (var variable is not equivalent to Var or VAR - they are three different variables) object-oriented language.

Syntax

Firstly, it is worth noting an interesting feature of Python. It does not contain operator brackets (begin..end in pascal or (..) in C), instead blocks are indented: spaces or tabs, and entering a block of statements is done with a colon. Single-line comments begin with a pound sign "#", multi-line comments begin and end with three double quotes """".

To assign a value to a variable, use the “=” sign, and “==” for comparison. To increase the value of a variable, or add to a string, use the “+=” operator, and “-=” to decrease it. All of these operations can interact with most types, including strings. For example

>>> myvar = 3

>>> myvar += 2

>>> myvar -= 1

"""This is a multi-line comment

Strings enclosed in three double quotes are ignored"""

>>> mystring = "Hello"

>>> mystring += "world."

>>> print mystring

Hello world.

# The next line changes

The values ​​of the variables are swapped. (Just one line!)

>>> myvar, mystring = mystring, myvar

Data structures

Python contains data structures such as lists, tuples and dictionaries). Lists are similar to one-dimensional arrays (but you can use a List containing lists - a multidimensional array), tuples are immutable lists, dictionaries are also lists, but indexes can be of any type, not just numeric. "Arrays" in Python can contain data of any type, that is, one array can contain numeric, string, and other data types. Arrays start at index 0 and the last element can be accessed at index -1 You can assign functions to variables and use them accordingly.

>>> sample = , ("a", "tuple")] #The list consists of an integer, another list and a tuple

>>> mylist = ["List item 1", 2, 3.14] #This list contains a string, an integer and a fraction

>>> mylist = "List item 1 again" #Change the first (zero) element of the sheet mylist

>>> mylist[-1] = 3.14 #Change the last element of the sheet

>>> mydict = ("Key 1": "Value 1", 2: 3, "pi": 3.14) #Create a dictionary with numeric and integer indices

>>> mydict["pi"] = 3.15 #Change the dictionary element under index "pi".

>>> mytuple = (1, 2, 3) #Specify a tuple

>>> myfunction = len #Python allows you to declare function synonyms this way

>>> print myfunction(mylist)

You can use part of an array by specifying the first and last index separated by a colon ":". In this case, you will receive part of the array, from the first index to the second, not inclusive. If the first element is not specified, then the count starts from the beginning of the array, and if the last element is not specified, then the array is read to the last element. Negative values ​​determine the position of the element from the end. For example:

>>> mylist = ["List item 1", 2, 3.14]

>>> print mylist[:] #All array elements are read

["List item 1", 2, 3.1400000000000001]

>>> print mylist #The zeroth and first elements of the array are read.

["List item 1", 2]

>>> print mylist[-3:-1] #Elements from zero (-3) to second (-1) are read (not inclusive)

["List item 1", 2]

>>> print mylist #Elements are read from first to last

Strings

Strings in Python separated by double quotes """ or single quotes """. Double quotes can contain single quotes, or vice versa. For example, the line “He said hello!” will be displayed as "He said hi!". If you need to use a string of several lines, then this line must begin and end with three double quotes """". You can substitute elements from a tuple or dictionary into the string template. The percent sign "%" between the string and the tuple replaces characters in the string “%s” to a tuple element. Dictionaries allow you to insert an element at a given index into a string. To do this, use the “%(index)s” construction in the string. In this case, instead of “%(index)s” the dictionary value at the given index will be substituted. index.

>>>print "Name: %s\nNumber: %s\nString: %s" % (myclass.name, 3, 3 * "-")

Name: Poromenos

Number: 3

String: ---

strString = """This text is located

on several lines"""

>>> print "This %(verb)s a %(noun)s." %("noun": "test", "verb": "is")

This is a test.

Operators

The while, if, and for statements constitute move operators. There's no equivalent to a select statement, so you'll have to make do with if . The for statement makes a comparison variable and list. To get a list of digits up to a number - use the range( function ). Here is an example of using operators

rangelist = range(10) #Get a list of ten digits (from 0 to 9)

>>> print rangelist

for number in rangelist: #As long as the variable number (which is incremented by one each time) is in the list...

# Check if the variable is included

# numbers to a tuple of numbers (3, 4, 7, 9)

If number in (3, 4, 7, 9): #If number is in the tuple (3, 4, 7, 9)...

# The "break" operation provides

# exit the loop at any time

Break

Else:

# "continue" performs "scrolling"

# loop. This is not required here, since after this operation

# in any case, the program goes back to processing the loop

Continue

else:

# "else" is optional. The condition is met

# if the loop was not interrupted with "break".

Pass # Do nothing

if rangelist == 2:

Print "The second item (lists are 0-based) is 2"

elif rangelist == 3:

Print "The second item (lists are 0-based) is 3"

else:

Print "Dunno"

while rangelist == 1:

Pass

Functions

To declare a function, use keyword "def". Function arguments are given in parentheses after the function name. You can specify optional arguments, giving them a default value. Functions can return tuples, in which case you need to write the return values ​​separated by commas. The keyword "lambda" is used to declare elementary functions.

# arg2 and arg3 are optional arguments, take the value declared by default,

# unless you give them a different value when calling the function.

def myfunction(arg1, arg2 = 100, arg3 = "test"):

Return arg3, arg2, arg1

#The function is called with the value of the first argument - "Argument 1", the second - by default, and the third - "Named argument".

>>>ret1, ret2, ret3 = myfunction("Argument 1", arg3 = "Named argument")

# ret1, ret2 and ret3 take the values ​​"Named argument", 100, "Argument 1" respectively

>>> print ret1, ret2, ret3

Named argument 100 Argument 1

# The following is equivalent to def f(x): return x + 1

functionvar = lambda x: x + 1

>>> print functionvar(1)

Classes

The Python language is limited in multiple inheritance in classes. Internal variables and internal class methods begin with two underscores "__" (for example "__myprivatevar"). We can also assign a value to a class variable from outside. Example:

class Myclass:

Common = 10

def __init__(self):

Self.myvariable = 3

Def myfunction(self, arg1, arg2):

Return self.myvariable

# Here we have declared the class Myclass. The __init__ function is called automatically when classes are initialized.

>>> classinstance = Myclass() # We have initialized the class and myvariable has the value 3 as stated in the initialization method

>>> classinstance.myfunction(1, 2) #The myfunction method of the Myclass class returns the value of the variable myvariable

# The common variable is declared in all classes

>>> classesinstance2 = Myclass()

>>> classesinstance.common

>>> classesinstance2.common

# So if we change its value in the Myclass class it will change

# and its values ​​in objects initialized by the Myclass class

>>> Myclass.common = 30

>>> classesinstance.common

>>> classesinstance2.common

# And here we do not change the class variable. Instead of this

# we declare it in an object and assign it a new value

>>> classinstance.common = 10

>>> classesinstance.common

>>> classesinstance2.common

>>> Myclass.common = 50

# Now changing the class variable will not affect

# variable objects of this class

>>> classesinstance.common

>>> classesinstance2.common

# The following class is a descendant of the Myclass class

# by inheriting its properties and methods, who can the class

# inherit from several classes, in this case the entry

# like this: class Otherclass(Myclass1, Myclass2, MyclassN)

class Otherclass(Myclass):

Def __init__(self, arg1):

Self.myvariable = 3

Print arg1

>>> classinstance = Otherclass("hello")

hello

>>> classesinstance.myfunction(1, 2)

# This class does not have the property test, but we can

# declare such a variable for an object. Moreover

# this variable will be a member of classinstance only.

>>> classinstance.test = 10

>>> classesinstance.test

Exceptions

Exceptions in Python have a try -except structure:

def somefunction():

Try:

# Division by zero causes an error

10 / 0

Except ZeroDivisionError:

# But the program does not "Perform an illegal operation"

# And handles the exception block corresponding to the “ZeroDivisionError” error

Print "Oops, invalid."

>>> fnexcept()

Oops, invalid.

Import

External libraries can be connected using the “import” procedure, where is the name of the library being connected. You can also use the "from import" command so that you can use a function from the library:

import random #Import the “random” library

from time import clock #And at the same time the “clock” function from the “time” library

randomint = random.randint(1, 100)

>>>print randomint

Working with the file system

Python has many built-in libraries. In this example, we will try to save a list structure in a binary file, read it and save the string in a text file. To transform the data structure we will use the standard library "pickle":

import pickle

mylist = ["This", "is", 4, 13327]

# Open the file C:\binary.dat for writing. "r" symbol

# prevents replacement of special characters (such as \n, \t, \b, etc.).

myfile = file(r"C:\binary.dat", "w")

pickle.dump(mylist, myfile)

myfile.close()

myfile = file(r"C:\text.txt", "w")

myfile.write("This is a sample string")

myfile.close()

myfile = file(r"C:\text.txt")

>>> print myfile.read()

"This is a sample string"

myfile.close()

# Open the file for reading

myfile = file(r"C:\binary.dat")

loadedlist = pickle.load(myfile)

myfile.close()

>>> print loadedlist

["This", "is", 4, 13327]

Peculiarities

  • Conditions can be combined. 1 < a < 3 выполняется тогда, когда а больше 1, но меньше 3.
  • Use the "del" operator to clear variables or array elements.
  • Python offers great opportunities for working with lists. You can use list structure declaration operators. The for operator allows you to specify list elements in a certain sequence, and the if operator allows you to select elements based on a condition.

>>> lst1 =

>>> lst2 =

>>> print

>>> print

# The "any" operator returns true if although

# if one of the conditions included in it is satisfied.

>>> any(i % 3 for i in )

True

# The following procedure counts the number

# matching elements in the list

>>> sum(1 for i in if i == 3)

>>> del lst1

>>> print lst1

>>> del lst1

  • Global Variables are declared outside functions and can be read without any declarations. But if you need to change the value of a global variable from a function, then you need to declare it at the beginning of the function with the keyword “global”, if you do not do this, then Python will declare a variable that is accessible only to that function.

number = 5

def myfunc():

# Outputs 5

Print number

def anotherfunc():

# This throws an exception because the global variable

# was not called from a function. Python in this case creates

# variable of the same name inside this function and accessible

# only for operators of this function.

Print number

Number = 3

def yetanotherfunc():

Global number

# And only from this function the value of the variable is changed.

Number = 3

Epilogue

Of course, this article does not describe all the features of Python. I hope this article will help you if you want to continue learning this programming language.

Benefits of Python

  • The execution speed of programs written in Python is very high. This is due to the fact that the main Python libraries
    are written in C++ and take less time to complete tasks than other high-level languages.
  • Because of this, you can write your own Python modules in C or C++
  • In the standard Python libraries you can find tools for working with email, protocols
    Internet, FTP, HTTP, databases, etc.
  • Scripts written using Python run on most modern operating systems. This portability allows Python to be used in a wide variety of areas.
  • Python is suitable for any programming solutions, be it office programs, web applications, GUI applications, etc.
  • Thousands of enthusiasts from all over the world worked on the development of Python. The support for modern technologies in standard libraries can be attributed to the fact that Python was open to everyone.

In this collection, we have collected the most useful books about the Python programming language that will help both beginners and experienced programmers learn.
Here you'll find materials for creating applications, as well as tutorials to help you become familiar with tools, master databases, and improve your professional skills.

Sections:

For beginners

The tutorial provides an excellent and internationally recognized introduction to the Python language. It will quickly teach you how to write efficient, high-quality code. Suitable for both beginner programmers and those who already have experience using other languages. In addition to theory, the book contains tests, exercises and useful illustrations - everything you need to learn Python 2 and 3. In addition, you will get acquainted with some advanced features of the language that not many specialists have yet mastered.

Python is a multi-paradigm cross-platform programming language that has recently become especially popular in the West and in large companies such as Google, Apple and Microsoft. Thanks to its minimalistic syntax and powerful core, it is one of the most productive and highly readable languages ​​in the world.

After reading this book, you'll learn the basics of the language quickly and in a fun way, then move on to exception handling, web development, SQL, data science, and Google App Engine. You'll also learn how to write Android apps and much more about the power that Python gives you.

Another award-winning Python book with 52 hand-picked exercises for language learning. Having analyzed them, you will understand how the language works, how to write programs correctly and how to correct your own mistakes. The following topics are covered:

  • Setting up the environment;
  • Code organization;
  • Basic Mathematics;
  • Variables;
  • Lines and text;
  • Interaction with users;
  • Working with files;
  • Loops and logic;
  • Data structures;
  • Software development;
  • Inheritance and composition;
  • Modules, classes and objects;
  • Packages;
  • Debugging;
  • Test automation;
  • Game development;
  • Web development.

This book is intended for beginners to learn programming. It uses a very standard approach to learning, but a non-standard language 🙂 It's worth noting that this is more of a book about the basics of programming than about Python.

The book Python Programming for Beginners is a great place to start. It is a detailed guide written specifically for beginners who want to master this language. Once you've learned the basics, you'll move on to object-oriented programming and creating CGI scripts to process web form data, and learn how to create graphical windowed applications and distribute them to other devices.

With the help of this tutorial, you will be able to go through all the steps from installing an interpreter to launching and debugging full-fledged applications.

"Python Crash Course" is a capacious narrative about the Python language. In the first half of the book, you'll become familiar with core language concepts such as lists, dictionaries, classes, and loops, and learn how to write clean, readable code. In addition, you will learn how to test your programs. The second half of the book asks you to put your knowledge into practice by writing 3 projects: an arcade game like Space Invaders, a data visualization application, and a simple web application.

This is a very handy pocket cheat sheet created for Python 3.4 and 2.7. In it you will find the most necessary information on various aspects of the language. Topics covered:

  • Built-in object types;
  • Expressions and syntax for creating and processing objects;
  • Functions and modules;
  • OOP (we have a separate one);
  • Built-in functions, exceptions and attributes;
  • Operator overloading methods;
  • Popular modules and extensions;
  • Command line options and development tools;
  • Hints;
  • Python SQL Database API.

A book for learning Python with lots of practical examples.

Practical examples can also be found in our section. For example, read our guide on how to implement the zip function yourself.

The purpose of this book is to introduce the reader to popular tools and various coding guidelines accepted in the open source community. The basics of the Python language are not covered in this book, because it is not about that at all.

The first part of the book describes the various text editors and development environments that can be used to write Python programs, as well as many types of interpreters for various systems. The second part of the book introduces the coding style adopted in the open source community. The third part of the book contains a brief overview of many Python libraries that are used in most open source projects.

The main difference between this book and all other manuals for beginners in learning Python is that, in parallel with studying the theoretical material, the reader gets acquainted with the implementation of projects for various games. This way, the future programmer will be able to better understand how certain language features are used in real projects.

The book covers the basics of both the Python language and programming in general. An excellent book for your first introduction to this language.

For advanced

If you want to move to Python 3 or properly update your old code written in Python 2, then this book is for you. And also for you - on transferring a project from Python 2 to Python 3 without pain.

In the book you will find many practical examples in Python 3.3, each of which is discussed in detail. The following topics are covered:

    • Data structures and algorithms;
    • Lines and text;
    • Numbers, dates and times;
    • Iterators and generators;
    • Files and read/write operations;
    • Data coding and processing;
    • Functions;
    • Classes and objects;
    • Metaprogramming;
    • Modules and packages;
    • Web programming;
    • Competitiveness;
    • System administration;
    • Testing and debugging;
    • C extensions.

As you read this book, you'll develop a web application while learning the practical benefits of test-driven development. You'll cover topics such as database integration, JS automation tools, NoSQL, web sockets, and asynchronous programming.

The book covers Python 3 in detail: data types, operators, conditions, loops, regular expressions, functions, object-oriented programming tools, working with files and directories, and frequently used standard library modules. In addition, the book also focuses on the SQLite database, the database access interface, and ways to retrieve data from the Internet.

The second part of the book is entirely devoted to the PyQt 5 library, which allows you to create applications with a graphical interface in Python. Here we consider tools for processing signals and events, managing window properties, developing multi-threaded applications, describing the main components (buttons, text fields, lists, tables, menus, toolbars, etc.), options for their placement inside the window, tools for working with databases data, multimedia, printing documents and exporting them in Adobe PDF format.

Your Python programs may work, but they can run faster. This practical guide will help you better understand the language, and you will learn how to find bottlenecks in your code and improve the speed of programs that work with large amounts of data.

As the title suggests, the purpose of this book is to provide the most complete understanding of the Django web application development framework. Due to the fact that the book was published in Russian back in 2010, it discusses an outdated version of the framework, Django 1.1. But still, the book is recommended for reading, since it can teach you the basics of Django. And there are practically no good books on this framework in Russian except this one.

Authors Adrian Golovaty and Jacob Kaplan-Moss take a closer look at the framework's components. The book contains a lot of material on developing Internet resources using Django - from the basics to such special topics as PDF and RSS generation, security, caching and internationalization. It is recommended that you master the basic concepts of web development before reading this book.

Game development

"Making Games with Python & Pygame" is a book that is dedicated to the Pygame game development library. Each chapter provides the full source code for the new game and detailed explanations of the development principles used.

Invent Your Own Computer Games with Python teaches you how to program in Python using game development as an example. Later games explore creating 2D games using the Pygame library. You will learn:

  • use loops, variables and logical expressions;
  • use data structures such as lists, dictionaries and tuples;
  • debug programs and look for errors;
  • write simple AI for games;
  • create simple graphics and animations for your games.

Data Analysis and Machine Learning

Improve your skills by working with data structures and algorithms in a new way - scientifically. Explore examples of complex systems with clear explanations. The book suggests:

  • Learn concepts such as NumPy arrays, SciPy methods, signal processing, fast Fourier transforms, and hash tables;
  • get acquainted with abstract models of complex physical systems, fractals and Turing machines;
  • explore scientific laws and theories;
  • analyze examples of complex problems.

This book introduces Python as a tool for solving problems that require large-scale computation. The goal of this book is to teach the reader how to use Python's data mining stack to effectively store, manipulate, and understand data.

Each chapter of the book is devoted to a specific library for working with big data. The first chapter covers IPython and Jupyter, the second covers NumPy, and the third covers Pandas. The fourth chapter contains material about Matplotlib, the fifth - about Scikit-Learn.

"Python for Data Analysis" talks about all kinds of ways to process data. The book is an excellent introduction to the field of scientific computing. Here's what you'll get to know:

  • interactive IPython shell;
  • library for numerical calculations NumPy:
  • pandas data analysis library;
  • library for plotting matplotlib.

You will also learn to measure data over time and solve analytical problems in many areas of science.

This book teaches you various data analysis techniques using Python. Here's what you'll learn after reading:

  • manage data;
  • solve data science problems;
  • create high-quality visualizations;
  • apply linear regressions to evaluate relationships between variables;
  • create recommendation systems;
  • process big data.

This manual explains the principles of natural language processing in clear language. You'll learn to write programs that can process large sets of unstructured text, gain access to large data sets, and become familiar with basic algorithms.

Other

If you've ever spent hours renaming files or updating hundreds of table cells, you know how exhausting it can be. Do you want to learn how to automate such processes? Automate the Boring Stuff with Python shows you how to create programs that solve a variety of routine tasks in minutes. After reading, you will learn how to automate the following processes:

  • search for specified text in files;
  • creating, updating, moving and renaming files and folders;
  • searching and downloading data on the Internet;
  • updating and formatting data in Excel tables;
  • splitting, merging and encrypting PDF files;
  • sending letters and notifications;
  • filling out online forms.

An excellent book with a minimum barrier to entry. It talks more about biology than about language, but it will definitely be useful to everyone working in this field. Equipped with a large number of analyzed examples of varying complexity.

This book covers the basics of programming a Raspberry Pi system. The author has already compiled many scripts for you, and also provided an intelligible and detailed guide to creating your own. In addition to the usual exercises, you are invited to implement three projects: the game "Hangman", an LED clock and a software-controlled robot.

"Hacking Secret Ciphers with Python" not only tells the history of existing ciphers, but also teaches you how to create your own programs for encrypting and breaking ciphers. An excellent book for learning the basics of cryptography.

Share useful books on Python in the comments!

ABOUT Python(better pronounced "python", although some say "python") - the subject of this study, is best said by the creator of this programming language, the Dutchman Guido van Rossum:

"Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Built-in high-level data structures combined with dynamic typing and binding make the language attractive for rapid application development (RAD, Rapid Application Development). It can also be used as a scripting language to communicate software components. Python syntax is easy to learn and emphasizes code readability, which reduces software maintenance costs. Python supports modules and packages, encouraging modularity and code reuse. The Python interpreter and large standard library are available freely as source and executable code for all major platforms and can be freely redistributed."

As we study, the meaning of this definition will be revealed, but for now it is enough to know that Python is a universal programming language. It has its advantages and disadvantages, as well as areas of application. Python ships with an extensive standard library for solving a wide range of problems. High-quality libraries for Python are available on the Internet in various subject areas: word processing tools and Internet technologies, image processing, tools for creating applications, database access mechanisms, packages for scientific computing, graphical interface building libraries, etc. In addition, Python has fairly simple means for integration with the C, C++ (and Java) languages, both by embedding the interpreter into programs in these languages, and vice versa, by using libraries written in these languages ​​in Python programs. The Python language supports several paradigms programming: imperative (procedural, structural, modular approaches), object-oriented and functional programming.

We can consider Python to be a whole technology for creating software products (and their prototypes). It is available on almost all modern platforms (both 32-bit and 64-bit) with a C compiler and on the Java platform.

It may seem that there is no room in the software industry for anything other than C/C++, Java, Visual Basic, C#. However, it is not. Perhaps, thanks to this course of lectures and practical exercises, Python will gain new adherents for whom it will become an indispensable tool.

How to describe the language?

This lecture does not aim to describe Python systematically; there is an original reference guide for that. Here it is proposed to consider the language from several aspects simultaneously, which is achieved by a set of examples that will allow you to quickly get acquainted with real programming than in the case of a strict academic approach.

However, it is worth paying attention to the correct approach to describing the language. Creating a program is always a communication in which the programmer transmits to the computer the information necessary for the latter to perform actions. The way the programmer understands these actions (that is, the “meaning”) can be called semantics. The means of conveying this meaning is syntax programming language. Well, what the interpreter does based on what is passed is usually called pragmatics. When writing a program, it is very important that there are no failures in this chain.

Syntax is a completely formalized part: it can be described in formal language syntax diagrams (which is what the reference manuals do). The expression of pragmatics is the language interpreter itself. It is he who reads the “message” recorded in accordance with the syntax and turns it into actions according to the algorithm embedded in it. The only informal component remains semantics. It is in translating meaning into a formal description that the greatest difficulty of programming lies. Python's syntax has powerful features that help bring the programmer's understanding of a problem closer to the interpreter's "understanding" of it. The internal structure of Python will be discussed in one of the final lectures.

History of the Python language

Python was started by Guido van Rossum in 1991 when he was working on the distributed Amoeba OS. He needed an extensible language that would provide support for system calls. ABC and Modula-3 were taken as a basis. He chose Python as a name in honor of the BBC comedy series Monty Python's Flying Circus, and not at all after the name of the snake. Since then, Python has developed with the support of the organizations in which Guido worked. The language is being improved especially actively at the present time, when not only the team of creators is working on it, but also a whole community of programmers from all over the world. Still, the final word on the direction of language development remains with Guido van Rossum.