background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Уроки по Python 3 для новичков / Часть #8 - PyCharm и Финальная практика"

input logo icon
Table of contents
|

Table of contents

0:00
Перечисления в Python (enum)
11:45
Введение в линтеры (linter)
24:32
Установка "системного" Python
28:59
Виртуальное окружение (venv, virtual environments)
40:31
Установка PyCharm
48:45
Создаём проект в PyCharm
53:05
ДЗ "Виселица"
53:16
Разбор ДЗ "Виселица"
Similar videos from our catalog
|

Similar videos from our catalog

Python для начинающих. Урок 17: Наследование (ООП), функция super(), Полиморфизм.
27:47

Python для начинающих. Урок 17: Наследование (ООП), функция super(), Полиморфизм.

Channel: alishev
Урок №9 | Вторая PyQt5 Программа - Объектно-Ориентированная | Python 3 - разработка GUI на PyQt5
20:21

Урок №9 | Вторая PyQt5 Программа - Объектно-Ориентированная | Python 3 - разработка GUI на PyQt5

Channel: Masters of Code
Урок №14 | Наследование | Python 3 - разработка GUI на PyQt5 | Python 3 Уроки Для Начинающих
13:17

Урок №14 | Наследование | Python 3 - разработка GUI на PyQt5 | Python 3 Уроки Для Начинающих

Channel: Masters of Code
Как выучить python
4:06

Как выучить python

Channel: Oldest Junior
Python для начинающих. Урок 16: Атрибуты класса (статические атрибуты).
17:11

Python для начинающих. Урок 16: Атрибуты класса (статические атрибуты).

Channel: alishev
[ОТКРЫТЫЙ КУРС] Python для финансистов - РАБОТА С МАССИВАМИ: МОДУЛЬ NUMPY - Урок 1
12:01

[ОТКРЫТЫЙ КУРС] Python для финансистов - РАБОТА С МАССИВАМИ: МОДУЛЬ NUMPY - Урок 1

Channel: SF Education | Официальный канал компании
Python практика | Программа заказа пиццы | разбор ДЗ | урок 10
8:49

Python практика | Программа заказа пиццы | разбор ДЗ | урок 10

Channel: Django School | Омельченко Михаил
Python работа с файлами | Python срезы  | разбор ДЗ | урок 9
18:49

Python работа с файлами | Python срезы | разбор ДЗ | урок 9

Channel: Django School
Python для начинающих. Что такое вызов функции. #3
4:53

Python для начинающих. Что такое вызов функции. #3

Channel: Правильное программирование
Урок №12 | Определение Класса И Создание Объектов | Python 3 - разработка GUI на PyQt5
19:45

Урок №12 | Определение Класса И Создание Объектов | Python 3 - разработка GUI на PyQt5

Channel: Masters of Code
Video tags
|

Video tags

python уроки
программирование на python
программа на python
python для новичков
python для чайников
как выучить python
питон уроки
программирование с нуля
python для начинающих
python с нуля
питон с нуля
python обучение
программирование для начинающих
уроки пайтон
пайтон с нуля
уроки питона
python программирование
программирование для чайников
как стать программистом с нуля
как изучить программирование
как стать программистом самостоятельно
python
engineerspock
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:00
we have dealt with classes, however, in
00:00:03
python there is one interesting type
00:00:05
with which you can create
00:00:06
specialized classes, and this type
00:00:09
is called to us from the word and well, mirei shin
00:00:12
or enumeration enumeration
00:00:14
is supported by many
00:00:16
programming languages, including those
00:00:17
supported by python. It is interesting to
00:00:19
note that enumeration in the coat not
00:00:21
powerful enough and allow you to do a lot of things,
00:00:24
unlike many other
00:00:27
programming languages ​​in which you die
00:00:29
now they are so flexible in order to
00:00:32
use this type we
00:00:35
borrow it from the library and
00:00:37
well
00:00:38
from an mind import and well, now we
00:00:43
can create an enumeration let's
00:00:47
create an enumeration
00:00:48
and it will immediately be clear what this
00:00:51
class actually is, the enumeration is created
00:00:54
using the class class, let's say traffic
00:00:58
light and this class is inherited from the type and
00:01:04
well, then comes a colon
00:01:06
and then we list the members of this
00:01:11
enumeration and assign them or
00:01:15
associate certain values ​​with them
00:01:18
in in this case, red yellow & green,
00:01:24
the colors of the traffic light, that is, numbers and tires,
00:01:27
allows you to specify a certain set of
00:01:29
values ​​in the form of symbols and
00:01:32
associate some values ​​with them,
00:01:34
most often these are numbers, but generally
00:01:38
speaking, when we inherit seeds from and
00:01:41
we can have not only numbers but
00:01:43
and strings and in general any objects, most
00:01:46
often I repeat, these are still
00:01:48
numbers to refer to the member and
00:01:51
numbering we can refer to in this
00:01:54
way traffic light.
00:01:57
and then the name of one of the values, if
00:02:04
we execute it, we will see traffic light.
00:02:06
n: one if we simply send print
00:02:10
traffic
00:02:12
light red
00:02:15
then we will receive traffic light red we can not
00:02:20
only output traffic light red but also
00:02:22
access the value using the
00:02:26
name or value attribute, that is, we can
00:02:28
enter the name and min name or value
00:02:31
separately for this we can write
00:02:33
print traffic light red further name and,
00:02:41
accordingly, we can also output the value,
00:02:43
you can see here that we output
00:02:46
red and one, you
00:02:49
can also go through the enumeration in a loop for forty in
00:02:56
traffic light colons print and
00:03:01
so we see all the members of this
00:03:03
impression and we can also access the
00:03:06
members of the enumeration through
00:03:13
parentheses, for example traffic light units
00:03:16
gives us red the
00:03:17
first member and we can also access by
00:03:21
name through square brackets the value of the
00:03:26
enumeration can be compared with the
00:03:28
values ​​of the enumeration and accordingly
00:03:31
print
00:03:32
traffic light red equals equal traffic
00:03:37
light red should give true a traffic
00:03:41
light red should not be equal to traffic
00:03:46
light green, for example, by the way, to
00:03:48
pay attention, I forgot to say that
00:03:50
exactly the value is written exactly in the
00:03:54
slot, but as I already said, if we
00:03:58
inherit from and to us, then the value can
00:04:01
be any objects, not only numbers,
00:04:03
if we want to limit possible
00:04:06
values
00:04:07
are numbers and then still be
00:04:09
able to compare them with each
00:04:11
other through less more then we need to
00:04:14
inherit from int n mind
00:04:18
and for this we import from and we
00:04:22
import int n mind we will create a class for example
00:04:29
priority
00:04:30
priority which we inherit from and
00:04:33
in law is equal to one normal is equal to two high is
00:04:39
equal to three that is, I think you already
00:04:43
understand what the numbers and shindo
00:04:46
and numbers lead to
00:04:55
we just have several
00:04:58
named descriptive members with
00:05:01
which a value is associated;
00:05:03
indeed, this is sometimes convenient,
00:05:05
just like with traffic light or priority,
00:05:08
and since we inherited from the antenna,
00:05:10
now we can write write the
00:05:12
expression priority low less than priority,
00:05:16
well, let’s say the norm and get pipes,
00:05:20
but if if we inherited simply from
00:05:23
and well, then this would cause an error. We
00:05:26
can also inherit from the type int flag
00:05:29
and
00:05:30
from treatment and to us from and flick
00:05:32
is that in the case of phlegm
00:05:35
we can combine the value using logical
00:05:38
operators, for example the color class,
00:05:44
and by the way, let's for him vs
00:05:47
frontman import in flac class color
00:05:59
black
00:06:02
colon say equals 1 green equals 2
00:06:14
blue equals 4 and now we can set
00:06:19
combinations for example combination equals
00:06:21
color . red or color green
00:06:32
ok bus harvesters if we output
00:06:34
we get green or red equal to three that is a
00:06:38
logical operator was applied
00:06:40
or to these two values ​​also by the way
00:06:44
we can check the
00:06:46
occurrence of a value in a certain intersection
00:06:50
that is we intersection using or
00:06:52
received we can check is included is the series in
00:06:55
this intersection really included in the
00:06:58
documentation there is a cool example with the
00:07:00
creation and the number is decided concerning the
00:07:03
planets let's look at it the class of
00:07:06
planets is inherited from anne and are declared
00:07:10
but I will declare several planets in total
00:07:12
mercury equals we create heat where the
00:07:18
first value will be the mass 3 303
00:07:23
e + 23 plus 23 is sante fig Natashin
00:07:32
for us it’s not very important 43 97 e6
00:07:41
for example equals 5 976
00:07:48
e + 24 and 6.37
00:07:55
814 e6 well let’s say Ju Peter
00:08:04
1.9 e plus twenty seven seven integer 1492
00:08:12
is seven and we can declare
00:08:19
a constructor here using the familiar and
00:08:22
not and the first two arguments with and radius
00:08:31
they will be correlated with the values ​​of the
00:08:34
heat features we have decided the
00:08:40
possibility of using such a
00:08:43
syntax
00:08:44
radius and we can declare a property
00:08:49
using the property decorator this
00:08:52
calculated value will be which
00:08:54
we simply do not want to use the
00:08:57
conditionally 40 method from gravity falls everything as
00:09:03
usual we are here we will have the function
00:09:07
universal gravitational constant g
00:09:09
equals 667 300 e in minus minus 11 riter
00:09:18
g multiplied by 7 cm c
00:09:22
divided by c radius multiplied by
00:09:28
construction squared radius and now
00:09:33
we can ask planet let's execute and
00:09:40
here we will ask planets . . in or for example
00:09:48
excellent or we can ask the planets cars
00:09:53
surf from gravity everything works fine, that
00:09:58
is, the numbers and tires in concrete,
00:10:01
for example, they are much more interesting than in
00:10:04
some sycharpe that do not
00:10:07
allow you to announce all sorts of
00:10:10
such methods and write such constructions,
00:10:13
but once again if you generally have a
00:10:15
list of logically interconnected
00:10:18
named constants, then it may be
00:10:20
useful to declare something like this,
00:10:22
which can be used to
00:10:25
write clear code and numbering
00:10:28
is created quite often and in my
00:10:31
opinion you can see such an antipater, roughly
00:10:33
speaking, it is not a good approach when instead of and
00:10:35
we decided we use
00:10:39
some kind of string values ​​instead of
00:10:42
creating a strictly typed one
00:10:44
and the number decided for example python has a
00:10:48
built-in open function into which the second
00:10:50
argument is passed a line indicating the
00:10:53
file opening mode and there we
00:10:57
actually pass the line and there we can
00:11:00
pass w р р + b + a a + r b and so
00:11:07
on, a whole bunch of lines when we want to
00:11:11
pass this argument, we have no
00:11:13
clue at all what the possible values ​​are,
00:11:15
but if we could pass as the second value
00:11:17
yes and plus, we can actually pass
00:11:19
whatever we want since this
00:11:21
line
00:11:22
we can just make a mistake and transfer
00:11:24
there whatever we want, but if
00:11:27
it were numbers and buses with
00:11:29
predefined values, then in my
00:11:31
opinion the software interface of this
00:11:33
method would only benefit from this.
00:11:35
I hope it is now clear in what cases it
00:11:37
can be used and we have decided in what
00:11:39
cases it really may be
00:11:41
justified in this lecture I would like to
00:11:48
talk about such an important thing as
00:11:50
code quality, generally speaking,
00:11:54
code quality is determined by different
00:11:56
characteristics and one of the main ones
00:11:59
is readability, the so-called reada
00:12:02
whitewash and and ease of support for my
00:12:05
secret ticket, these are very important things,
00:12:09
poor readability
00:12:10
and difficulty of support are often lead
00:12:14
to all sorts of hidden defects such as
00:12:16
rigidity and bugs, generally speaking, of course,
00:12:22
rigidity, that is, the difficulty of expanding the
00:12:24
software before writing
00:12:26
new code, and bugs are, of course, very
00:12:29
significant shortcomings, but in fact,
00:12:31
readability and ease of support are
00:12:33
in themselves very important characteristics
00:12:36
that are already indicate the quality of the code and
00:12:39
if everything is bad with this, then this becomes the
00:12:41
first step towards
00:12:43
hidden defects appearing such as rigidity,
00:12:46
complexity of software extensions
00:12:48
and bugs, but which there is
00:12:50
nothing to say
00:12:51
in order to create some kind of groundwork that
00:12:54
allows achieving the minimum
00:12:56
code quality The python community
00:12:59
supports a large set of documents
00:13:02
regulating the process of writing code,
00:13:04
which are called pep, short for
00:13:07
python enhancement, about a pause, and by
00:13:11
going to this address
00:13:13
we will see a whole bunch of documents.
00:13:16
I said that this foundation creates a certain
00:13:20
minimum for the actual minimum
00:13:23
code quality, despite the fact that this a
00:13:26
huge number of documents for the
00:13:27
reason that good code quality
00:13:31
cannot be achieved
00:13:32
in fact in large right large
00:13:34
software following there
00:13:37
n-th number of documents the importance of
00:13:39
these documents is undeniable, however, I
00:13:43
just want you to understand that having studied
00:13:46
all these documents, for example, this does not mean
00:13:48
that your programs will never again
00:13:51
contain hidden defects there, and
00:13:52
so on, this is a certain minimum, the main
00:13:57
types are PEP 8, which prescribes the
00:14:00
coding style, that is, it talks about
00:14:03
what the steps should be,
00:14:05
how to correctly name arguments, how to
00:14:08
import modules correctly, well, in short, the
00:14:11
coding style and pep 20 which is called
00:14:14
Mr. Python and taking python which
00:14:18
contains the principles of the
00:14:20
main method the principles of how to
00:14:23
program in Python
00:14:24
let's follow the link and just
00:14:28
look at what we have in general here is this one on the
00:14:31
link that I wrote down python arxiv
00:14:34
pips
00:14:35
and here you can see it Yandex bike
00:14:40
these grief here is the method eps 8 this is meta pepp and the
00:14:46
information zen python refers to this is how
00:14:49
I put the guide for therefore cold here 8
00:14:55
we will open 20 in Russian well 20
00:15:01
is translated for sure it is probably translated into
00:15:03
all languages ​​of the world I don’t know if all pepps
00:15:05
are translated into Russian but most likely
00:15:07
everything, although I could be wrong, I just
00:15:12
almost never read documentation in Russian, but in python the cortex is
00:15:16
so I advise you to read it,
00:15:19
certainly the price of Python cannot be read and
00:15:23
learned, but it seems to come with experience,
00:15:27
that is, you need to keep in mind this very Zen
00:15:29
Python and be guided by it when
00:15:32
writing code, but how to
00:15:35
be guided correctly only comes with
00:15:37
experience because there are no specific
00:15:39
recommendations on
00:15:40
where to use what functions, there are no
00:15:42
specifics here, this is the principles
00:15:44
of programming in the Python language 520 pe
00:15:48
8, this is a fairly large document
00:15:52
that tells you how it’s correct
00:15:55
not to import and put white space is an
00:15:58
expression statements that’s how it’s
00:16:02
correct how not there’s a lot of
00:16:05
examples and so on Peppa I recommend
00:16:10
reading 8 20 this is the basis of the basics
00:16:15
let’s go back to the slides generally speaking
00:16:19
a lot of regulations from these documents
00:16:24
from these regulations checking these the very
00:16:27
requirements can be automated, and everything
00:16:30
that can be automated needs to be
00:16:32
automated, for example, of course,
00:16:36
all the principles of coding for everything, namely
00:16:39
style, where are the indentations, and so
00:16:42
on, well, all this is easily subject to
00:16:44
automatic analysis
00:16:47
and, accordingly, such a
00:16:49
concept as lind appears, roughly speaking, these are
00:16:52
stylistic braids and potential
00:16:55
bugs due to illogical conditions or illogical
00:16:58
passing of arguments really,
00:17:01
in principle, it depends on
00:17:04
how we write the code,
00:17:05
we will talk about this separately;
00:17:07
automated tools that
00:17:09
checkers who check the
00:17:11
quality of the code can detect not
00:17:13
only stylistic pigtails but also
00:17:15
really potential bugs due to
00:17:16
illogical conditions and all this is considered
00:17:18
tapes,
00:17:19
and these most automated
00:17:21
tools that check the code for
00:17:22
stylistic logical jambs
00:17:24
are called battleships and the most
00:17:27
popular are, apparently,
00:17:29
poyling
00:17:30
and flake 8, which is a combination of
00:17:34
battleships pie flakes ration out style
00:17:37
and maccabi also have built-in cylinders
00:17:41
For example, enter the charm share with which we will
00:17:44
speak battleships, like all
00:17:47
automated tools, are good
00:17:49
because they can be configured to
00:17:52
autorun, for example, battleships can
00:17:55
work on the background while typing
00:17:56
code, we will see in the charme share
00:17:59
how to program and in the evenings
00:18:01
it analyzes our code on the fly and
00:18:04
gives suggestions what's wrong where are some
00:18:08
pigtails? It highlights everything for us and gives
00:18:12
text hints
00:18:13
that here you are wrong, you need to
00:18:15
correct it here. This, of course, gives a
00:18:18
huge advantage
00:18:19
when you are developing especially large
00:18:22
software, when amateurs
00:18:26
write some small linker scripts and, of
00:18:30
course, it may not be they have such weight
00:18:34
as in cases when large
00:18:37
teams work there, distributed over large
00:18:39
software, large there are
00:18:42
hundreds of thousands of lines of code, yes there is
00:18:44
software with hundreds of thousands of
00:18:45
lines of code, and when such
00:18:49
large software is being developed, then
00:18:51
absolutely all the tools are used,
00:18:53
absolutely all touring available for
00:18:55
automation of auto checks,
00:18:58
that is, they screw everything up to the maximum,
00:19:00
configure it for auto checks, etc., so
00:19:04
that no bugs slip through, any
00:19:06
means are good for this, also
00:19:09
battleships are configured for autorun and before
00:19:12
minting, that is, before we
00:19:14
send it to the code base, for example,
00:19:18
in git or another the version control system,
00:19:21
the code is automatically launched by
00:19:25
Linder and checks whether
00:19:27
the number of errors has increased, for example, they are
00:19:29
configured differently if you already have
00:19:32
some kind of software,
00:19:34
that is, you got the code from
00:19:36
other programmers and there are a lot of
00:19:38
errors, then usually Linder they don’t
00:19:40
set it up in such a way that chikin does not
00:19:42
occur if errors are found, but
00:19:44
they set it up in such a way that chikin
00:19:46
passes if the number of errors
00:19:48
found by the battleship has not increased, well, there
00:19:51
are different variations and they are set up as
00:19:53
part of Katya new sand you play on the continent
00:19:55
you play for that there is a separate very large
00:19:57
topic about which to remove You can have a separate
00:19:58
video of the course, but it does not relate
00:20:00
directly to programming, it
00:20:02
relates more to infrastructure
00:20:04
things and how projects are assembled, how
00:20:09
they are deep caught, that is, they are deployed,
00:20:11
tests are run, how all this
00:20:13
is configured, and so on, this is how part of
00:20:15
this continues integration, that is,
00:20:16
the process of building software
00:20:19
and often its deployment somewhere on the
00:20:23
target machines is also configured for
00:20:26
autorun or enter and unit
00:20:30
tests are run there and so on,
00:20:31
including battleships and continues integration at the
00:20:35
end it displays either a red light or
00:20:37
green red if an error occurred at least at one stage
00:20:39
green if everything is in
00:20:41
order, that’s what
00:20:43
battleships are and before we look at how the
00:20:46
built-in Void Void or
00:20:48
enter Pai Charnovsky works, it’s very powerful,
00:20:51
let’s see for example how we can
00:20:52
use Palin there is the oldest,
00:20:55
probably well, still supported
00:20:57
Linder one of the most popular battleships
00:21:00
like him you can run a script on
00:21:02
some share and look at the
00:21:06
output,
00:21:08
so let's try to
00:21:10
use Pauline there and set it
00:21:12
on some file with the extension dot
00:21:15
share, I'll run anaconda front and I
00:21:24
can just simply register the poyling,
00:21:27
run the poyling
00:21:28
and feed it, for example, ours a file that
00:21:31
lies along the path c tempo test 06
00:21:42
abstract class with and Bessie
00:21:48
everything we wrote in Joe Peter’s laptop,
00:21:53
it’s all with violations of the coding style
00:21:58
because it’s damn impossible to write differently for those who like to write,
00:22:00
okay, let’s do it and
00:22:04
wait for the answer, just like I said
00:22:08
miracles don’t happen, so poyling
00:22:12
gave us the results of the analysis of our script
00:22:16
written in python, everyone
00:22:20
complains and yes, all his complaints that
00:22:23
begin with c this means coat style,
00:22:26
as it were, the date that this vodka resisted was
00:22:28
violated trading whitespace training
00:22:30
thanks loot
00:22:33
again hehe- hey, this is a warning,
00:22:36
it means a warning, this is a more serious
00:22:38
mistake, I’m an error, that is, it’s with her, and
00:22:48
this is the most serious thing that we have
00:22:50
written there, that is, a description of
00:22:52
what he doesn’t like in general, this is
00:22:57
refactoring for us, which means this is refactoring,
00:23:01
which means that we can change something there,
00:23:02
like the rule of uniformity to
00:23:05
duplication of code, something else
00:23:07
that we can improve there precisely in terms of
00:23:10
refactoring, that is, minor alterations of the
00:23:12
code that do not change its meaning but
00:23:14
make it better, but this again does not
00:23:18
apply to the
00:23:19
coding style these are
00:23:21
guests to exactly how we design,
00:23:23
in fact, the cat is saying that we
00:23:26
can somehow improve the code
00:23:27
structurally, that’s how things are and that’s how
00:23:32
poyling works, the
00:23:34
main battleships work on the same principle and you can
00:23:37
feed
00:23:38
entire projects with a bunch of
00:23:43
source files there from files with source
00:23:45
code and they will accordingly
00:23:48
display to us everything that they consider necessary,
00:23:51
of course, work like this purely in the
00:23:54
console, here something to read is not
00:23:56
particularly convenient; it is much more convenient to
00:23:58
work with battleships, for example in the same share
00:24:00
black or in other ideas in which
00:24:02
the winter is built in and which immediately immediately
00:24:05
shows everything that is wrong and we
00:24:08
immediately correct it without waiting for the formation of
00:24:11
whole heaps of all sorts of unpleasant things
00:24:15
about poyling, you can read in more detail
00:24:18
on poyling ark
00:24:20
here there is complete documentation on how
00:24:23
this whole thing is installed, how to use it
00:24:25
use continues integrations
00:24:28
and so on before we presented
00:24:35
ruim share charm and in general we’ll see how to
00:24:37
use this food eshka
00:24:39
and generally do a little programming in share
00:24:41
charm we need to figure out what the
00:24:44
environment is and before we
00:24:46
figure out what the environment is I
00:24:49
would do the following
00:24:50
at the moment, if you have researched
00:24:52
clearly what the course says, you have an
00:24:56
anaconda distribution kit with a set of
00:24:59
library and interpreter, I suggest
00:25:03
since we will use the
00:25:06
in warm environment and the so-called virtual environment,
00:25:09
I propose to install as if
00:25:12
the system python and it will not be anaconda
00:25:14
not anaconda distribution kit and
00:25:17
standard Python distribution kit
00:25:18
downloaded from python ark and in the next
00:25:21
lecture when we will understand
00:25:23
what the environment is, I will already explain why
00:25:25
we do this and so
00:25:32
python org this is the official python website
00:25:40
here you can go to dou loot and
00:25:43
they will give you
00:25:45
python 374 for windows download the distribution is
00:25:54
actually in mac os and in Linux,
00:25:56
as far as I know, python comes with a
00:25:59
system built-in one, as a rule, by the
00:26:02
way, outdated versions, but our
00:26:06
system one for us now
00:26:08
is essentially anaconda, but we
00:26:11
will use the
00:26:14
standard python distribution as the system one, they are
00:26:16
anaconda because that this is connected with the
00:26:18
virtual environments that we
00:26:20
will build, we will run the installer, you can
00:26:27
add the path to this Python to this
00:26:31
vps interpreter so that you can
00:26:34
work with our system from cmd,
00:26:37
this will not prevent us if we
00:26:40
want to work with the
00:26:42
Anaconda interpreter and its libraries because everything
00:26:45
what we need to
00:26:46
differentiate between these pythons
00:26:49
is that with our system python,
00:26:52
which we also install, we can
00:26:54
work through standard cmd, and if you
00:26:56
want to work with anaconda, just
00:26:57
launch the anaconda front and you will
00:27:00
work with the anaconda environment and if
00:27:02
you run the command python will
00:27:04
launch the
00:27:06
Anaconda interpreter, and if we just go into cmd,
00:27:09
for example, and run the
00:27:11
python command, it will launch exactly
00:27:13
the interpreter that we are
00:27:15
installing now, I’m here to customize,
00:27:19
let everything be, but I just want to do
00:27:26
install for all users and push it in,
00:27:32
let it be program files in the table the
00:27:42
installation is trivial, and plus if, for
00:27:46
example, someone doesn’t download anaconda but
00:27:50
downloads a charm piece, as far as I remember,
00:27:52
charm comes without the actual package and is run
00:27:57
without an interpreter, so Python
00:27:59
Ark will have to be downloaded then the interpreter is
00:28:01
in any case, I think that with the
00:28:04
chapman piece it’s better create a virtual environment
00:28:06
on the basis of the so-called virtual environment,
00:28:11
based on virtual environments,
00:28:13
support for which is built into regular
00:28:15
python in the on account of scam distribution kit,
00:28:18
it is supported, it is supported,
00:28:20
witchcraft virtual environments may not
00:28:26
mean anything to anyone now, but literally in the next
00:28:28
lecture we will start with to understand this,
00:28:30
in short, in combination with pie chapman, let
00:28:33
’s say I recommend using the
00:28:35
regular one, so they are the
00:28:38
anaconda distribution kit, and the installation is
00:28:44
completed perfectly, now if I just
00:28:49
run cnd and say python,
00:28:54
the interpreter should start
00:28:55
fine, but now let’s talk about the
00:29:01
so-called virtual environments,
00:29:03
so about which I have already mentioned in
00:29:06
general, that is considered the program environment, the
00:29:11
program environment is considered to be the
00:29:13
interpreter that is used to
00:29:16
execute the code and the set of libraries, in
00:29:19
general, this is the
00:29:21
program environment, and we will start with where the
00:29:24
packages are installed; the default packages,
00:29:26
for example, via pip
00:29:28
are installed in global
00:29:31
package repositories and if I run
00:29:35
these commands import site site site just
00:29:38
get your site pager via anaconda
00:29:41
via Ju Peter for example then I
00:29:44
will always indicate these are these
00:29:47
paths yes this is exactly it it will
00:29:50
still show in the direction of anaconda
00:29:52
if we installed
00:29:55
system python via python ark
00:29:58
added it to ps if we
00:30:02
run python through cmd, launch the interpreter and
00:30:06
run the import site site site
00:30:08
site get your site soldering jazz these paths
00:30:12
will show where the system
00:30:16
interpreter is installed, I
00:30:19
installed it in c program files at the last step x86 python
00:30:22
37 32
00:30:23
this is a global package repository this is a
00:30:26
global package repository in the first
00:30:28
case from the point of view of anaconda to the
00:30:30
anaconda environment in the second case from the point of
00:30:33
view of system python
00:30:36
thus when we write a program
00:30:39
for example in amateurs and do an import there
00:30:42
packages will be imported from the
00:30:46
global repository packages and
00:30:49
if we are writing a program under
00:30:51
the system python am that is global
00:30:53
its global package repository
00:30:55
in this case they are separated since
00:30:58
these are
00:30:59
different distributions, each
00:31:01
distribution can define its own
00:31:03
global repository when this is where
00:31:06
actually using packages from
00:31:08
global repositories is problematic
00:31:11
actually fraught with consequences,
00:31:12
for example, it doesn’t matter which global
00:31:16
package repository we are talking about anaconda,
00:31:18
if we use or system python,
00:31:21
suppose program a wants to
00:31:23
use package and z version 1 and
00:31:25
program b package z version 2 what to do
00:31:30
if we import packages from the
00:31:34
global repository then we have nothing it wo
00:31:36
n’t work because we can’t
00:31:38
use two packages of
00:31:40
different versions there. The solution is to
00:31:44
isolate programs
00:31:45
or projects using a virtual
00:31:48
environment or so-called virtual; it
00:31:50
will return this virtual
00:31:53
environment itself and consists of a set of libraries
00:31:56
and the interpreter itself,
00:31:59
that is, isolating the program environment
00:32:02
allows in this project, on any project
00:32:05
to which we isolate, use a
00:32:07
separate copy of the interface
00:32:08
and a separate set of packages
00:32:10
including the standard library,
00:32:12
this gives us the opportunity in each
00:32:16
project to use those libraries of the
00:32:19
versions that we want, the
00:32:21
interpreter of the version that we
00:32:23
need and when we update packages in
00:32:27
one virtual environment, packages from
00:32:29
another environment,
00:32:32
or even let there be a global
00:32:34
repository, all of them turn out to be
00:32:35
unaffected by the update of tits and
00:32:38
only the package is updated in the environment
00:32:40
in which we update it, there are different
00:32:43
systems of
00:32:44
these same environments, there is a Vents former
00:32:47
point prohibited from 36 in the status of deprecate
00:32:51
kate from is a new product to the account now
00:32:54
it is a standard way of working with
00:32:56
environments in python built-in
00:32:59
standard library there is a ppf based on
00:33:00
pip there is a conda well actually a
00:33:03
honda honda environment they are just an
00:33:06
anaconda distribution kit more for
00:33:08
those who are involved yes this is science so we
00:33:11
will see how to work pig to you and
00:33:15
also for the reason that Pai Charam is
00:33:18
more friendly to Pig to you he supports
00:33:20
events and pippin second actually but
00:33:23
I somehow had problems when I
00:33:25
set up a
00:33:27
virtual environment in Pai Charam through the
00:33:29
kund some errors arose I then
00:33:32
dad the forest started googling, got into the support with the
00:33:36
top charmo, it turned out that someone
00:33:38
also had the same problem and the
00:33:40
support had a funny answer like, why are
00:33:43
you doing this until all the time and surrounded you don’t
00:33:45
use it as a share chapman is best
00:33:47
Vents well, kind of strange actually in fact,
00:33:49
the answer is because if you already
00:33:50
support three environmental systems, then
00:33:53
well, in general, then you fix them,
00:33:54
support them, but unfortunately I
00:33:57
had a lot of errors there, that’s why
00:33:59
I would still
00:34:02
use Ven in the general case, I would
00:34:06
use Evens and Neil covered the grandmother
00:34:08
but we’ll see how you
00:34:10
can use venach without share
00:34:12
charmo through the console, that is, we’ll just
00:34:15
look at the basics of what happens,
00:34:17
how we use venach, how a
00:34:21
virtual environment is created, let’s see what is
00:34:23
created there in the folders,
00:34:25
and so to create a virtual
00:34:29
environment through aries, I’ll launch cmd and
00:34:35
execute command therefore d.sm
00:34:45
with this argument you need to run ven and
00:34:48
after ven you and well, if we
00:34:52
want to create in the current directory giving engineer
00:34:54
spock for example in this case we can just
00:34:57
come up with a folder name for
00:35:00
this virtual January for which we
00:35:02
create for example
00:35:06
ven test
00:35:13
enter and wait a little
00:35:22
now let's see what's going on in the
00:35:25
Jenner Spock scene,
00:35:29
our screw test folder
00:35:32
has been created if we go into it we
00:35:35
will see here the following
00:35:36
directory structure include or a script and according to vin
00:35:40
cfg
00:35:41
well cfg is a configuration file basic
00:35:48
means that here in the include folders there are detention
00:35:51
facilities heads for compiling
00:35:55
Python packages, now it’s true that the folder is empty,
00:35:58
or there is a copy of the
00:36:01
Python interpreter with a folder
00:36:04
site package where dependencies are installed,
00:36:06
and the script contains files with
00:36:12
which we can manage the
00:36:14
virtual environment, in particular in
00:36:17
order to launch a
00:36:19
copy of the interpreter from this
00:36:21
virtual environment and work
00:36:23
with it and, for example, install packages
00:36:27
in this particular virtual environment,
00:36:28
first we must activate it and for
00:36:30
this we must launch assets bad for
00:36:34
this I can run a vein test
00:36:39
script assets it bad after activation we
00:36:46
can launch the python interpreter
00:36:49
or install packages with using pip and
00:36:51
in all cases we will run all
00:36:55
these commands specifically in relation to our
00:36:56
activated
00:36:58
virtual environment, so from
00:37:01
now on we can quite easily
00:37:05
work with this
00:37:08
virtual environment with the help of some of our favorite tools, and after
00:37:11
we have worked with it we want
00:37:13
switch to some other virtual
00:37:15
January, we need to make de assets and
00:37:20
then we kind of disconnect from this
00:37:24
virtual environment and switch
00:37:26
to another one that we need, and if
00:37:32
we suddenly decide to move to another
00:37:33
project
00:37:35
and well, let me remind you that projects are
00:37:38
currently recommended everything should be carried with
00:37:40
virtual environments,
00:37:43
let's activate it again and using the
00:37:49
pip list command, let's see what
00:37:52
packages we have installed here in this
00:37:55
virtual environment, let's try to
00:37:58
install, say, a flag and see again
00:38:08
that we have a flask here,
00:38:12
accordingly, now if we start
00:38:15
the interpreter and let's say import flask that
00:38:21
command will be successful, we will
00:38:24
import the module perfectly, this is of
00:38:35
course just the most basic
00:38:36
demonstration, in fact there are a
00:38:43
lot of tools for working with virtual environments and I would be in your place
00:38:46
if you want to manually manage this whole thing
00:38:51
and not use, for example, chapman pie
00:38:53
where most of this whole routine is
00:38:56
automated, then perhaps it would be better to
00:39:00
decide for yourself, for example, what
00:39:02
to use again, vents or pet and piping,
00:39:05
because after all, it wraps veins and
00:39:08
piping and you don’t have to fool around with the
00:39:11
romance textile river
00:39:13
where all the dependencies are recorded separately
00:39:16
in your project and so
00:39:20
then there is a
00:39:21
wrapper you need in order to
00:39:24
easily switch between different
00:39:25
virtual environments and well, there are a number of
00:39:29
commands for simplified work with
00:39:31
many
00:39:34
virtual environments, so there are
00:39:37
many tools for working with
00:39:41
packages of virtual environments and
00:39:43
we, of course, will not analyze them all here
00:39:46
we can just wanted to demonstrate the
00:39:49
meaning of what a virtual
00:39:52
environment is and more or less how it
00:39:54
works and actually showed that it
00:39:55
really works, that we activate
00:39:58
the environment and that’s where
00:40:01
we install the package, and again, don’t
00:40:05
forget to deactivate the virtual
00:40:07
environment before switching to
00:40:09
some then another thing is to install
00:40:11
packages in another place and use
00:40:13
another copy of the python interpreter, but we
00:40:18
move on to a more serious tool
00:40:20
and look at how to work with
00:40:24
chapman pie, one of the most powerful
00:40:26
IDs for programming in the
00:40:29
python language, and so we begin to
00:40:33
use a very serious idea for
00:40:36
development to go no and I’m here
00:40:40
showing you the site jetbrains dot com
00:40:42
because the developers of this hole share the
00:40:46
charms with jetbrains
00:40:47
generally speaking I’ll say right away to be honest
00:40:50
no one paid me for this
00:40:53
if anyone might think that this is an
00:40:54
advertisement for jetbrains then no it’s not so not
00:40:57
I just want to say that besides pie
00:40:59
charged brains, there are actually a lot of
00:41:02
excellent tools and they will make the
00:41:07
coolest shortness of breath in general in the world, at
00:41:10
least in the one in which we exist, they have the
00:41:12
coolest and you give to for java
00:41:15
which is called int or Jay's idea,
00:41:17
by the way, in it also has a community
00:41:19
version, they have the coolest feature for the
00:41:24
java script webstorm, the coolest idea
00:41:26
for the sysharp raider, which is now being
00:41:30
very actively developed, it’s still new,
00:41:32
they have the coolest plugin, essentially
00:41:36
raider, only built-in visual studio,
00:41:39
this is Richard Pere’s plugin for knitting studio,
00:41:43
yes you're flu and df kind of sql databases they
00:41:46
have a ton of tools in general and I'm
00:41:48
such a big fan of
00:41:52
jetbrains tools that in fact I have
00:41:54
a license for all of their products they
00:41:57
have such a license,
00:41:59
let's go to the target and see
00:42:05
what they have here they have a tool box of
00:42:08
scripture means here for the organization
00:42:10
for individual user but I have frenzy john
00:42:13
use yes I just buy myself an
00:42:16
annual subscription to absolutely all
00:42:19
products and all the products are here they are this is a
00:42:22
whole list oh yes and chic this is a separate
00:42:25
dot on this study visa tim tools there
00:42:28
they have that city for continues in the
00:42:31
creation of and other things they have a tracker
00:42:35
there to track bugs and stuff like that, well,
00:42:40
this stove is above them, they have a new section here
00:42:41
by the way, you can take a look before,
00:42:43
maybe you will be interested and their prices are
00:42:46
actually very affordable,
00:42:50
I have an all products pack, roughly speaking, this is the
00:42:52
third year there, and in fact I
00:42:55
pay ten thousand rubles a year, but at the current exchange
00:42:57
rate for 2019 in September it
00:43:01
turns out to be 10 thousand a year, this is of course for
00:43:03
those who
00:43:04
Well, he really lives by programming, and in
00:43:07
one sense or another, he
00:43:09
constantly teaches programming or
00:43:12
programmid there, and he just writes programs
00:43:15
all the time, to be honest, even when the
00:43:18
company provided me with a license for the
00:43:22
tools that I needed,
00:43:24
I still had all the products Pak
00:43:25
Tatyana just switched to it a long time ago
00:43:28
prodexpo I don’t care at all I absolutely
00:43:30
needed to learn something there,
00:43:33
some language jetbrains has everything for everything
00:43:35
for everything so I
00:43:38
’ll actually use the pro version of Pai Charmo
00:43:46
just about us Odessa charm is the
00:43:49
coolest toy in my opinion for
00:43:52
development in python and accordingly
00:43:56
we’ll do it down here you can
00:44:01
download the community version but there will be
00:44:04
problems with development for example under
00:44:07
such fry standards as djanga it’s
00:44:10
really problematic so I’m planning to
00:44:14
expand this course most likely a
00:44:16
section on working
00:44:21
with django will be added with this figure server website
00:44:24
programming and I plan to use
00:44:27
the finger because I’m very used to it,
00:44:29
and
00:44:31
unfortunately the support is only in the
00:44:33
pro version. The only thing I can
00:44:36
immediately recommend is that when
00:44:39
you study the course, in principle, you can
00:44:41
buy a monthly subscription, for example, it’s
00:44:43
not expensive at all there, in the region of 1000
00:44:46
rubles,
00:44:47
this is enough to take the course,
00:44:49
in fact, in principle, you can find a
00:44:52
cracked version from all sorts of trackers and other things
00:44:55
that really work, but it’s just that it’s
00:44:58
not a T-shirt, as they say in
00:45:01
English, I don’t recommend such
00:45:04
methods and I don’t like piracy
00:45:07
but in principle, I know that in fact,
00:45:13
companies like
00:45:15
jetbrains they mainly
00:45:18
make money, of course, from corporate
00:45:19
subscribers, so I’m not strong,
00:45:21
for example, I myself am kind of angry at those who don’t
00:45:25
buy a license, but somehow and
00:45:29
others are not very at least legal
00:45:31
it doesn’t reach very well, but to be
00:45:33
honest, I didn’t think it was very strange, it’s
00:45:35
not very scary when it’s done
00:45:37
for individual use,
00:45:39
it’s not that deadly, but with me,
00:45:41
of course, they may not agree to this, some kind of
00:45:44
compromise, especially if you’re just
00:45:46
studying,
00:45:47
then even more so as if you do
00:45:48
n’t make money from this and still
00:45:50
want to study the charm share in more depth,
00:45:53
the community won’t work either and you
00:45:56
will need a professional version, if
00:46:00
you exclude django and take the rest of the
00:46:02
course, then the community will work just fine, you don’t
00:46:05
need a license, just do it here
00:46:07
gave it an itch and install using the nyx nyx
00:46:10
nyx method, roughly speaking, well, I’ll install the
00:46:13
professional version of myself,
00:46:16
I started downloading, and
00:46:21
accordingly, I’ll come back when it’s
00:46:22
over and show you the
00:46:25
installation process, in case you also
00:46:27
decide whether to install the professional version in a legal or illegal
00:46:31
way
00:46:33
and so I downloaded the installer,
00:46:39
I’ll run it,
00:46:45
install it along the standard path that is
00:46:48
suggested to me, create an association of spy
00:46:53
scripts and make it so that by
00:46:55
default it will open the software and scripts.
00:46:58
We probably don’t need anything else here. I don’t
00:47:01
need it. Charm installed successfully, I’ll
00:47:07
check the box, let’s go and I’ll do
00:47:10
the finish, you can close everything, so I had a
00:47:18
version of Pai charmo there, I just deleted it
00:47:23
to show you this whole
00:47:25
installation, although in fact it was
00:47:27
completely trivial, I won’t
00:47:28
import the setting here, we’ll do everything
00:47:31
in a new way, we’ll configure it now, so
00:47:35
here we can select the dark theme street
00:47:39
dark or light light
00:47:43
dark street is selected by default and as I understand
00:47:45
it is still more
00:47:47
popular among developers, although some prefer
00:47:50
light well, in fact, in some conditions
00:47:52
elite is more preferable,
00:47:59
I just want to personally support
00:48:02
mark down and click launch
00:48:14
so, to create a new project you need
00:48:17
to click on crit not project, you can
00:48:20
see that here we can create
00:48:22
projects of different types including django
00:48:24
flask farming and so on, and perhaps in
00:48:28
this lecture we will not create the
00:48:31
project directly, we should have even
00:48:34
stopped a little earlier after all I’ll
00:48:36
probably break this down into different lectures:
00:48:38
installation and already the creation of the first project,
00:48:40
so in the next lecture we will continue
00:48:46
so we continue we create a new
00:48:50
pure Python project without any frameworks
00:48:53
and here we write the path in which a
00:48:58
new root folder will be created for
00:49:01
our project,
00:49:03
let’s call our first project first project
00:49:07
and we will reveal the settings here, these settings
00:49:11
relate to the virtual environment,
00:49:14
here we can select the type of this
00:49:17
virtual environment virtual and even if I
00:49:19
can do I have already said that I prefer to
00:49:21
use virtual for you and the lakin
00:49:25
location for the virtual environment will be
00:49:29
like this, respectively, the first project is
00:49:31
added to it daddy venakh basic
00:49:34
interpreter you can see that according to the
00:49:37
thermobar there are already three
00:49:38
anaconda system interpreters which we
00:49:41
have installed and the interpreter
00:49:44
and connected the student I have visual studio
00:49:48
also installed on my machine but I
00:49:50
prefer to use the
00:49:52
interpreter downloaded from python arc en
00:49:55
and accordingly this interpreter
00:49:57
will be copied to ours
00:49:59
it in our virtual environment here,
00:50:03
as a rule, you don’t need to set anything, you
00:50:05
can then just click craig and
00:50:10
wait a little
00:50:14
here by the way, all sorts of good
00:50:18
tips on how to use the software and
00:50:20
chapman, you don’t have to turn them off right away,
00:50:23
run through them a little read and
00:50:26
roughly speaking you are actually In fact,
00:50:28
you will immediately learn a lot about charme, how to
00:50:30
use it, all sorts of keyboard shortcuts,
00:50:32
and so on, I will expand it to full screen,
00:50:40
here in the left window we have the project structure
00:50:47
in the vents folder, you don’t need to add your scripts, it’s
00:50:51
better to create a separate folder,
00:50:59
or just add scripts here,
00:51:03
well it all depends on the actual
00:51:05
size of the project we are talking about, as a
00:51:08
rule, everything is divided into folders,
00:51:10
sometimes it’s quite complex
00:51:11
hierarchical structures are not not too
00:51:14
usually complex, but sometimes there is nesting of
00:51:16
1 to 2 folders, still the maximum, probably they
00:51:19
can also be added to the root
00:51:23
files, we can simply add
00:51:26
a directory, name it with arci,
00:51:29
and add scripts directly here, so
00:51:43
we have created the first piece of script and we can
00:51:48
write something here, let’s say it
00:51:54
will be hello world, we can go to the
00:51:58
run menu, or so to speak, is there a run
00:52:03
more than
00:52:04
f10 here and when our configuration is still
00:52:10
empty
00:52:11
when we have not indicated which script to
00:52:13
start executing the program with as the top
00:52:15
charms asks which one will offer us
00:52:18
programs, in fact, for the simple
00:52:20
reason that we are the only program you can
00:52:23
see here, that the configuration has changed,
00:52:25
we have now added the
00:52:27
launch configuration of our project, which In
00:52:31
fact, here goes configurations says
00:52:33
that the script is with,
00:52:36
that is, start execution of the program from
00:52:38
this script,
00:52:39
and now when we can now we can
00:52:44
without shift without without alt and shift and in 10
00:52:47
if we want to run our project
00:52:50
using the current configuration it says about the current
00:52:52
configuration run from
00:52:53
programs, we can simply use the
00:52:55
combination shift f10 and we see the output
00:53:02
right here with
00:53:03
hello world charms,
00:53:16
well, let's try to implement a
00:53:19
hangman game, I'll create it, well, in theory, you
00:53:24
can actually create it inside, let's
00:53:26
create a separate folder, I
00:53:29
'll call it hangman that is, to have fun and the
00:53:35
main files we will have two,
00:53:38
roughly speaking, client code and, roughly
00:53:40
speaking, game logic, this time we will
00:53:43
clearly separate everything from making a
00:53:45
separate class that will deal
00:53:48
only with logic, that
00:53:50
is, we will put into practice the so
00:53:53
-called principle of separation of
00:53:54
concerns, that is separation of duties
00:53:57
or responsibilities between classes I
00:54:01
will create a file here in
00:54:03
Python I will call it day so what we will
00:54:11
do is create a class which we will call
00:54:13
day it will define a constructor
00:54:21
it will accept the number of allowed
00:54:23
their misses they will call this argument
00:54:26
allowed Mrs and let's
00:54:29
use this you it will be an integer
00:54:31
by by default is 6
00:54:36
if the Mrs. laut that was passed to us is
00:54:38
less than five or and the Mrs. laut is more than
00:54:45
eight
00:54:46
then we will throw an exception in or yuras we will say
00:54:53
number of low to miss from Shubin between
00:55:01
five and faith something like this still
00:55:10
breaks the spears between programmers in
00:55:13
there let's say such languages like Java Sysharp
00:55:15
and the power supply themselves on the topic of whether it is necessary to
00:55:21
hide it, make it conditionally private, yes,
00:55:24
with two underscores my attributes
00:55:27
that we do not want to be directly
00:55:30
visible to the client code, that is, a
00:55:33
more pita low approach is without
00:55:37
the need to hide everything in a row in the
00:55:40
client code code,
00:55:41
although this is a bit
00:55:46
presumptuous, that is, we hope
00:55:50
that we are all smart adults and
00:55:53
no one will interfere
00:55:55
when we make the attributes private, but
00:55:59
we want read access, then we will
00:56:01
need to declare a property property
00:56:03
that will be simple return the value
00:56:06
from the attribute, but in this case the code
00:56:09
becomes much more complex and
00:56:11
lengthy, let's make it
00:56:13
a little more complicated, let's do it
00:56:16
with properties and then I
00:56:21
'll create our attributes using
00:56:26
double underscore laut mrs equals
00:56:31
loudness then we need to create it
00:56:37
also
00:56:43
makes sense to make the thrice count attempt counter private because the
00:56:45
external code does not have the right
00:56:47
to modify it,
00:56:49
unfortunately, often the external code does
00:56:52
not have the right to modify anything at all,
00:56:54
so in all sisharpa hijabs the
00:56:57
properties are made in very short notes,
00:57:00
they are very convenient to use,
00:57:02
we also need to touch what were
00:57:05
Tribal tires letters have been tested, we
00:57:11
will have a list, we will also keep a list of
00:57:19
undiscovered
00:57:21
beech letters and we will also touch the game status,
00:57:30
game status, and the tire number, an
00:57:34
enumeration with the name game status,
00:57:37
initially it will be equal to not start at,
00:57:42
so I would create a separate file for and
00:57:51
number solved game status so there
00:57:56
will be a class game status here we have him
00:58:02
mirei shin well and which ones will be here
00:58:07
equals 1 lost equals 2 in progress in
00:58:14
progress
00:58:15
this is our 3 and not start of 4
00:58:25
so the Linder is yelling that other reishi must be
00:58:28
imported, import everything ok,
00:58:31
by the way, in order not to fall into the cross, here's
00:58:35
how to do it: hold shift and
00:58:36
poke anywhere on the obi and it will be
00:58:39
closed. Such a tricky thing. Well, here we
00:58:43
need to do an import,
00:58:46
so what does he not like, but how is this all
00:58:50
nonsense?
00:58:52
let's move on, what do we need? Well,
00:58:55
yes, and actually we will have the
00:58:58
word itself, the word itself, while it will be empty,
00:59:03
well, the first method that comes
00:59:05
to my mind is the method of generating the word jennie
00:59:09
reid art, so we will use a static path that is already
00:59:17
predetermined to go into the
00:59:19
dictionary I have words x words
00:59:23
that means the path will be
00:59:26
relative to the date it’s called
00:59:31
worlds stock rus the text
00:59:38
needs to be added to the project we’ll add it now that
00:59:43
means the list of words is declared open the
00:59:48
file file name encoding utf-8 and line
01:00:05
by line but it’s not too big
01:00:07
so we just proofread everything
01:00:12
word up and
01:00:15
we don’t do this kind of trimming for a
01:00:20
carriage return to a new line, well, how do we
01:00:24
select a random word from the list, well,
01:00:27
generate some some
01:00:31
number rand index equals random
01:00:38
imported
01:00:39
rand int from 0 to to the length of
01:00:48
this list itself minus 1 so as not to exit beyond
01:00:52
the borders, probably something like this, and
01:00:55
it turns out that the generated words
01:01:00
will be equal to worlds according to the
01:01:04
Yandex Rand index, so we get
01:01:07
randomly generated words with open
01:01:13
indices, we will have
01:01:18
absolutely everything by default, which means we will write down the fall for
01:01:27
all indexes in the list about the indices
01:01:30
everywhere we will put down the fall, well, simply how we
01:01:34
generated the words the status of the game is in
01:01:40
progress and we return the words it looks like the
01:01:53
truth
01:01:54
let's before we forget add the file to
01:01:57
our project so we will have an embedded I
01:02:04
folder data
01:02:07
and we need to add a file to it I will open
01:02:14
explorer I
01:02:21
copied the file and paste it here
01:02:25
it looks something like this,
01:02:35
here we have it, we need to
01:02:39
give the client code the ability
01:02:41
to guess the letter, and this means that we
01:02:43
need to roll out a method, well, let's call
01:02:48
it get better get summer,
01:02:52
and it will accept it, we
01:02:56
will have the type str,
01:02:58
by the way, in jennie reid word we didn’t
01:03:01
specify that we return string it’s
01:03:07
done like this in the case of no face in the
01:03:13
case of acid we return and trouble
01:03:25
by fire, that is, there will be lines for us,
01:03:30
well, realistically, we will have separate characters there
01:03:32
and what we will do here
01:03:36
is first of all to protect ourselves from calling
01:03:40
when it is impossible when it is
01:03:43
impossible when the number of attempts is
01:03:45
exhausted for example, respectively, if
01:03:48
thrice count and I propose to read
01:03:53
exactly our attributes by properties,
01:03:58
this means that we need to file such
01:04:00
such a property as whole from a swarm of three scouts
01:04:03
without two underscores and loudness with
01:04:07
too wrap up, well, how to do this, let's
01:04:12
immediately get distracted by this matter and roll out
01:04:15
all the properties that are needed, which means we'll create
01:04:20
property
01:04:23
df,
01:04:24
which means the game status of the current one will be
01:04:27
returned because he sat down game status still
01:04:38
property we will return words
01:04:45
more property will
01:04:50
return and Laut Mrs.
01:04:57
the same for thrice cauter
01:05:03
everything we all what we achieve in this
01:05:05
way is to limit access to external
01:05:08
code to our attribute external codes
01:05:12
can only read the value but not
01:05:14
change them, at least from the kondachka in
01:05:17
order to change the value in private
01:05:21
attributes you need to get out there in a special way
01:05:24
until let’s say We are also
01:05:27
rolling out the property
01:05:32
trident PC, but it will return and it will not
01:05:39
just be a list of dads of the tried letters, but
01:05:42
the return will be sorted by them
01:05:45
so that it is easier for the user to understand
01:05:47
which letters he has already tried to enter,
01:05:52
so we will pass the sort function to trident apc.
01:05:57
We also need to roll out a property for
01:06:01
convenience that will called the
01:06:03
remaining
01:06:04
thrice computable property, the so-
01:06:07
called one that will calculate the
01:06:10
belt and ncd rice by doing a simple
01:06:12
calculation up to loudness minus sat down
01:06:17
troy scout so while everything is gis liter
01:06:23
we continue, which means in this case
01:06:29
if we have from the chirp the number of
01:06:31
attempts then we raise
01:06:33
an exception and I like the exception everything
01:06:37
sharpei and which is excited in such
01:06:38
cases in the poet there is no such exception,
01:06:42
as if the purpose here p is not particularly suitable
01:06:46
because our exception should
01:06:49
indicate by the type itself that in general the method
01:06:51
cannot be called at the moment, that is, it is
01:06:55
impossible to execute the method in principle
01:06:58
at the current the state of the object and for
01:07:01
this purpose, here are all the shards, for example, there is a type
01:07:04
disabled operations exception, we will now
01:07:09
create it, and say here excited
01:07:13
when x
01:07:16
Mrs. we would like laut, that is, this is allowed, this is what
01:07:25
glues the class, well, let’s
01:07:32
create a class, it is inherited from
01:07:35
exceptions everything I pressed control alt
01:07:42
shift and it brings up the reflector ds menu.
01:07:44
if you want to directly apply
01:07:46
any refactoring while standing with the cursor
01:07:49
somewhere before on something you want to apply
01:07:51
refactoring, for example, you even forgot the walkers,
01:07:54
for this you can always use the
01:07:57
alt shift control and
01:07:58
Pai Charam will always show all the available
01:08:01
refactorings, I actually wanted to do
01:08:03
husband and send it to a separate file so
01:08:07
he offers tu-tu
01:08:11
January operations execution great
01:08:24
so where we stopped here
01:08:27
now everything works fine also this
01:08:31
method cannot be called if the game status is
01:08:34
not equal to in progress
01:08:36
well I can only guess the letters if
01:08:39
I’m playing progress, so we must also
01:08:43
protect ourselves from this, in general, if not in
01:08:52
progress, then we need to throw out the
01:08:56
disabled operational exceptions, please
01:08:59
note that I am using the so-
01:09:00
called Homs channel feature here, that is, I typed the
01:09:03
first letters of the words that make up our
01:09:09
type of disabled person, primary execution and share
01:09:11
charm I filtered it in such a way that
01:09:13
now you can just make auto complete
01:09:16
very convenient, I use it, you use it as
01:09:18
if this feature is constantly also, well, let’s say
01:09:21
here inappropriate and on the raid state as
01:09:27
of game current such and such, well, let’s set up
01:09:36
a flag here with which we will
01:09:38
touch was there an open letter, if a
01:09:41
letter was open, then we don’t need to
01:09:44
increment thrice to under thrice by
01:09:46
morning, only if more than
01:09:48
one letter was not guessed
01:09:50
according to the windows, we don’t call falls
01:09:53
and immediately create a result that we will
01:09:57
return, and we check whether it was necessary
01:10:01
at least one letter for i in range according to lin
01:10:07
sellsword the
01:10:14
current leader in the water will be equal to
01:10:18
sellsword
01:10:20
according to this index if the Kurli
01:10:25
coincides with the summer that was given to us
01:10:28
from the outside, that is, with the one with the letter that
01:10:32
the user entered
01:10:33
there and in about indexes according to this index
01:10:40
we put a corpse that is, the letter is open, well,
01:10:43
if at least one letter was open to
01:10:45
open and the flag does not become true in any case,
01:10:53
well, here we check if the experience of the indexes
01:10:59
on this is true there and embedded it,
01:11:05
we add the current liter of the current letter,
01:11:12
otherwise we add
01:11:17
a dash there
01:11:20
on this we exit the loop and if the experience is
01:11:28
not still false, that is, the letters
01:11:31
were not specified, none of the letters were
01:11:33
open there and thrice cautery
01:11:36
is incremented, and don’t forget that in
01:11:45
any case, the three of us
01:11:47
laters add the flour that
01:11:52
the user entered,
01:11:54
and here too again, we check if the
01:11:58
user has guessed all the letters, but we
01:12:00
can create a separate
01:12:02
auxiliary method here, roughly speaking,
01:12:06
private ones that are also not visible to the client
01:12:09
code, and here we will decide in a simple loop to go through the
01:12:16
open
01:12:19
index, if at least one of them is a fall, it
01:12:27
means that the user has not won yet,
01:12:30
but what if we haven’t returned the falls, which
01:12:34
means everything is open and we can
01:12:37
safely return true,
01:12:39
we come back here and check if
01:12:43
sorry ng returns true to we transfer the
01:12:48
game status to victorious
01:12:58
and if thrice counter is equal to loudness
01:13:12
then we transfer the game status status lost
01:13:24
means lost and so far, offhand, it seems to be
01:13:29
here everything seems to be the only thing that is
01:13:35
probably property on, you can also
01:13:38
add
01:13:40
types if we really want to go all the way,
01:13:44
and if we use to find and use it, then
01:13:46
it’s best to use them everywhere. By the
01:13:51
way, you can move between methods
01:13:52
and properties using alt and the
01:13:56
alt arrows, you see alt down alt up is also
01:13:58
convenient
01:14:05
by the way, here with should not pass this is
01:14:08
from riders and
01:14:13
we have 3 bolts from tear
01:14:17
and here we have an integer so let's create a
01:14:35
file called auckland well, let's start right on the
01:14:40
floor game is equal to game we generate words well,
01:14:46
by the way, we need to import
01:14:49
this way we generate words game jennie reid
01:14:56
word
01:14:59
viscount let's create here for simplicity this is
01:15:02
our city line and display something to
01:15:06
the user
01:15:07
let's say in word consists of
01:15:16
letters the count letters consists of talc
01:15:20
then the letters three guess the word order buy
01:15:32
better try to guess the word letter by
01:15:36
letter and while the
01:15:40
game status is equal to in progress,
01:15:47
by the way, it would be possible
01:15:50
to create a property there also in the game class of type is in
01:15:54
progress,
01:15:55
which, by the way, would be
01:15:56
preferable because this
01:16:01
comparison is the same logic, this is also
01:16:02
some kind of explicit knowledge about that
01:16:04
what the game status should be, well,
01:16:06
this is really not so important, but
01:16:09
nevertheless, I would also push this into the game, well,
01:16:13
we ask for input from the user, peak
01:16:19
l, it would be kind, select a letter and
01:16:28
we will try to call the acid accordingly
01:16:32
before passing the tattoo, which is what
01:16:36
the user entered
01:16:37
here and here we have a list
01:16:41
whose elements are letters and
01:16:44
carts, in theory it was possible to immediately
01:16:48
form a string, in principle,
01:16:50
let’s create some
01:16:53
auxiliary method here, call it chars
01:16:59
sheet that page
01:17:05
comes chars and do return joy, the
01:17:12
whole thing is simple we glue it
01:17:19
into a string,
01:17:25
by the way, now that we
01:17:28
have covered everything with type kents, the external code
01:17:31
here writes something calls a function,
01:17:33
you can call control q and see if a
01:17:36
liter is a type str,
01:17:39
yes, that is, we will not pass the wrong
01:17:42
type there when we know everywhere where what
01:17:44
types are written
01:17:47
where what types are expected excellent print
01:17:55
Charles that is and or and we pass it there it’s
01:17:57
super and we also display the remaining
01:18:06
thrice here you have the remaining thrice and
01:18:16
we display for the convenience of the user the letters
01:18:21
that he tried in sorted me well,
01:18:23
so you know how in a field of miracles it didn’t
01:18:25
work when people
01:18:30
choose the same letter ten times because I do
01:18:35
n’t remember, they said that accordingly, we
01:18:39
will make life easier for the user of trident
01:18:42
PC and when we exit the file
01:18:48
to fix it, display it here, let’s say if the
01:18:52
game status is lost, then we’ll say
01:19:02
you’re hanged your hand
01:19:10
and of course, so as not to scoff, let's say
01:19:13
what word was d'Ivoire duos
01:19:18
game world such and such, otherwise
01:19:26
the word was whatever so users
01:19:29
know what word they can just
01:19:31
say
01:19:32
congratulations and one super so let's
01:19:40
change the launch to line TP ah yes By the
01:19:43
way, this is the same kline pie omate is
01:19:54
probably not the same and the trouble here is from the
01:19:56
collections
01:20:07
this is the taipan which was here she is, so let’s
01:20:13
launch it like this for the word consists of five
01:20:19
letters straight from dice divor glitterboy
01:20:20
liter so let’s assume that dad is still somewhere there is a
01:20:25
mistake canon join in and trouble
01:20:30
and we didn’t return anything here we forgot
01:20:41
re-therm we’re here but the pendel and yes, it
01:20:45
turns out return trident riders like this
01:21:01
again, by the way, well,
01:21:06
wait, let’s stop for fun until
01:21:09
control slash commented on the line I
01:21:13
didn’t pay attention to the Linder he actually told us,
01:21:17
you see, the intern said that in general there is
01:21:19
no return here, I didn’t pay attention to this,
01:21:23
but we don’t have it configured either, so for
01:21:25
example, it would be impossible to run via
01:21:26
kalender
01:21:27
there, the inter is indignant, they are not
01:21:30
indignant anywhere else, no, it seems like nowhere, let’s
01:21:33
launch then 1 liter is silent, then most
01:21:37
likely everything is fine,
01:21:44
but I have the feeling that we
01:21:46
are displaying the state somehow poorly, somehow
01:21:49
incorrectly, we don’t have it, we
01:21:54
always have it equal to it, it’s not, it’s not troit
01:21:59
letters,
01:22:00
Lord, we don’t have it, but returned it we
01:22:02
have three volleys here, so we’ll eat here, let’s
01:22:04
go, here we are, up and
01:22:08
doing it, I hit it, I reported what
01:22:13
they say, of course we’re just
01:22:16
returning rizal here,
01:22:17
we’re just going back, cut it off, but the
01:22:20
battleship won’t catch it, of course, what can I
01:22:22
say, I even suggested adding
01:22:31
description so let's start again
01:22:34
now everything should be really
01:22:35
normal o I guessed two letters and the
01:22:39
belt remains on the track 6 o there is no such
01:22:44
letter k there is
01:22:46
no such letter l there is no such letter so r there is
01:22:56
no such letter p p I lost all the words
01:23:05
it was magma it turns out but you can
01:23:07
actually add here that like, would you like to
01:23:09
play again so that it’s convenient
01:23:11
so that you don’t have to restart
01:23:13
the program every time, so let me
01:23:17
win your own tree-stick game
01:23:19
and o k k you guessed l
01:23:24
so that’s n no e p about and kleshko oh
01:23:39
my gosh lyashko what a cruel thing it is no
01:23:44
here I don’t know anything until
01:23:47
I win out of 10 letters
01:23:49
I don’t care but maybe it’s easier to just be
01:24:02
stunned 2 2 attempts left so the strategy is
01:24:13
won one attempt
01:24:20
left well That’s just when big
01:24:22
words like 10 letters are usually
01:24:24
easier to guess, but when they were four
01:24:26
letters or 5, it’s more difficult, well, I’ll
01:24:30
tell you honestly, maybe here I
01:24:33
wasn’t able to demonstrate it everywhere, I want to
01:24:36
say that when behind the scenes I
01:24:40
wrote this code myself, I first
01:24:43
tried to write it
01:24:45
without type hand of, to be honest, I somehow
01:24:47
got used to Beijing there in principle, they are paid and
01:24:50
you know, even with such a simple
01:24:53
example, I constantly jumped from the client to
01:24:58
gameboy to see the report of where it was
01:25:01
transferred to where what type and of course, but
01:25:05
it’s not comparable, it’s incomparably easier to
01:25:08
actually use any kind of
01:25:10
api
01:25:11
that prescribes types that
01:25:14
prescribe types, this is of course a good thing, and there are
01:25:18
fewer errors, Linder
01:25:21
discovers this whole thing, the main thing is
01:25:24
to look at this matter in time, yes,
01:25:28
so when you use chapman’s dad
01:25:30
do not forget to look at what
01:25:34
the leader advises and what he finds because
01:25:36
often he shows all the trivial
01:25:39
errors that lead to the roof in the wound
01:25:43
t'aime

Description:

Данный курс на YouTube - сильно укороченная (демо) версия полного курса, который вы можете приобрести на stepik (с карточкой из РФ) или Udemy (с карточкой не из РФ) Купить полный курс на stepik: https://stepik.org/course/97054/pay?promo=YOUTUBE - скидка 30% по ссылке Купить полный курс на udemy: https://www.udemy.com/course/bestpython/?referralCode=38707CDAA07B6E109517 Все курсы от EngineerSpock: https://offer.engineerspock.com/ Подпишись на канал в Telegram: https://t.me/engineerspock_it Подписка на Boosty: https://boosty.to/engineerspock Донаты на развитие: https://pay.cloudtips.ru/p/1f080f72 Чат питонистов в Telegram: https://t.me/python_devs Ссылка на репозиторий в GitHub: https://github.com/EngineerSpock/Python-from-Zero-to-Hero --------------------------------------------------------------------------------------------------------- Изучаем язык программирования Python. Это именно тот язык с которого стоит начинать изучать программирование. Уроки по Python покрывают все основные возможности языка. На курсе масса домашних заданий и чат в телеграме, где общаются уже более 4500 студентов. Вы напишите множество программ на Python по ходу курса. Курс подойдёт как для новичков, которые никогда не пробовали программировать, так и программистам, которые хотят вникнуть в новый для себя язык программирования. Короче говоря, если вы не знаете как стать программистом с нуля, этот курс по пайтон с нуля - для вас! 00:00 Перечисления в Python (enum) 11:45 Введение в линтеры (linter) 24:32 Установка "системного" Python 28:59 Виртуальное окружение (venv, virtual environments) 40:31 Установка PyCharm 48:45 Создаём проект в PyCharm 53:05 ДЗ "Виселица" 53:16 Разбор ДЗ "Виселица" Подпишись на канал https://www.youtube.com/channel/UCTk5fSXUF_05q8U-Jx4uyLQ?sub_confirmation=1

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Уроки по Python 3 для новичков / Часть #8 - PyCharm и Финальная практика" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Уроки по Python 3 для новичков / Часть #8 - PyCharm и Финальная практика" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Уроки по Python 3 для новичков / Часть #8 - PyCharm и Финальная практика" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Уроки по Python 3 для новичков / Часть #8 - PyCharm и Финальная практика" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Уроки по Python 3 для новичков / Часть #8 - PyCharm и Финальная практика"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Уроки по Python 3 для новичков / Часть #8 - PyCharm и Финальная практика"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.