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

Download "Python - Курс Python Для Начинающих [1.5 ЧАСА]"

input logo icon
Table of contents
|

Table of contents

0:00
Обзор ускоренного курса Python
1:41
Привет от Питона
2:58
Базовые типы
4:17
Преобразование между типами
5:15
Ложные значения
6:04
Выбор названий для переменных и констант
7:08
Переменные и динамическая типизация
8:26
Базовые типы копируются по значению
9:28
Увеличение и уменьшение переменных
10:46
Списки
13:59
Tuples
15:50
Словари
22:07
Копирование по ссылке
24:38
Наборы
27:13
Итоги по типам контейнеров
30:09
Установка и настройка Code Runner в VS Code
36:26
Функции
41:45
Позиционные аргументы
44:00
Именованные аргументы
45:23
Сбор всех аргументов в tuple
47:20
Перебор значений с использованием цикла for...in
49:29
Использование kwargs в функциях
53:54
Описание функций
55:24
Операторы сравнения
57:22
Логический оператор and
59:58
Оценка короткого замыкания
1:02:53
Логический оператор or
1:05:27
Логический оператор not
1:06:30
Комбинация операторов и приоритет
1:07:56
Условные инструкции if
1:12:30
Форматирование строк
1:14:40
Обработка ошибок с использованием try…except
1:17:18
Модули Python
Similar videos from our catalog
|

Similar videos from our catalog

Уроки Python / Рекурсия
5:31

Уроки Python / Рекурсия

Channel: Изучаем мир ИТ / Олег Шпагин / Программирование
Урок №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
Урок №15 | Приватные Свойства И Методы | Python 3 - разработка GUI на PyQt5
9:44

Урок №15 | Приватные Свойства И Методы | Python 3 - разработка GUI на PyQt5

Channel: Masters of Code
Урок №10 | Сигналы и Слоты | Python 3 - разработка GUI на PyQt5 | Python 3 Уроки Для Начинающих
5:04

Урок №10 | Сигналы и Слоты | Python 3 - разработка GUI на PyQt5 | Python 3 Уроки Для Начинающих

Channel: Masters of Code
Эти ошибки совершает каждый новичок Python / 11 Ошибок которые нужно исправить
14:05

Эти ошибки совершает каждый новичок Python / 11 Ошибок которые нужно исправить

Channel: ZProger [ IT ]
🚀 Python С НУЛЯ. #4 | Уроки для начинающих. | Методы для работы со строками.join/ split/ find/ index
1:04:46

🚀 Python С НУЛЯ. #4 | Уроки для начинающих. | Методы для работы со строками.join/ split/ find/ index

Channel: SENATOROV.Уроки математики.Программирование.Python
Урок №17 | Диалог QMessageBox | Python 3 - разработка GUI на PyQt5 | Python 3 Уроки Для Начинающих
21:36

Урок №17 | Диалог QMessageBox | Python 3 - разработка GUI на PyQt5 | Python 3 Уроки Для Начинающих

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

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

Channel: Masters of Code
Как понять, что происходит в коде? Отладка python кода на pythontutor.com
5:21

Как понять, что происходит в коде? Отладка python кода на pythontutor.com

Channel: egoroff_channel
Video tags
|

Video tags

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

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:00
Welcome to the Python course for
00:00:02
beginners in this course I will teach you
00:00:05
the key functions of python which is most
00:00:07
often used in real projects and
00:00:09
we will cover the following topics basic
00:00:12
types such as strings or integers
00:00:14
container types such as lists or
00:00:17
dictionaries assigning values ​​to variables
00:00:19
converting the meaning of different types
00:00:21
logical operators and
00:00:24
comparison operators conditional statements Elos
00:00:27
functions loops and string formatting
00:00:29
Let's get started and First you need to
00:00:32
check if python is installed on your
00:00:34
computer for this Open any
00:00:36
terminal on Mac I use it ram You
00:00:39
can also use the default terminal
00:00:42
If you are a Windows user
00:00:44
You can for example use
00:00:45
powershell or git bash
00:00:48
here in the terminal enter python minus
00:00:50
Minus vorusion If you are working on Mag
00:00:53
enter Python Free minus Minus varusion
00:00:56
because on macos there are two
00:00:59
different versions of python available in this
00:01:01
crash course We will use the
00:01:02
third version of python on Windows or
00:01:06
Linux Just enter Python minus Minus
00:01:08
voroshin Let's check the version I see
00:01:11
that python version 3.9.4 is installed on my computer
00:01:13
If you see an error
00:01:17
instead of version So you need to
00:01:19
install python
00:01:21
to install python go to the
00:01:23
python.org download page and download
00:01:26
python for your operating system it
00:01:29
available for Windows Linux and macos
00:01:32
And after that, double-check the version of
00:01:35
python If you see a specific version
00:01:38
in this output, then python is installed
00:01:41
[music]
00:01:45
let's start learning python and in the
00:01:48
first part of this course we will
00:01:50
use an interactive
00:01:51
python shell, to enter such a shell you
00:01:54
just need enter Python in the terminal
00:01:56
on Windows or Linux or Python 3 on
00:01:59
macos And after that press Enter the
00:02:02
interactive shell was launched and
00:02:04
here I see details about the specific
00:02:06
version of python in my case I am using
00:02:09
python 3.9.4 and here is the exact version and also
00:02:14
below you see the interactive command
00:02:16
line consisting of three characters more And
00:02:19
now here you can enter any
00:02:21
Python commands and the Python interpreter
00:02:24
will interpret them and return the
00:02:26
result for example Let's call the
00:02:29
Print function which will print the
00:02:31
result of a certain expression into the
00:02:33
terminal and here in these brackets where we
00:02:36
call the print function we can enter
00:02:38
say a line
00:02:40
and press
00:02:42
Enter
00:02:43
and I see Hello From Python here in this
00:02:46
interactive shell you can also
00:02:49
pass several expressions to the Print function
00:02:51
for example the string ABC and the number 10
00:02:54
and I see ABC and 10 in the terminal
00:02:58
[music]
00:03:02
Now let's talk about basic types
00:03:05
in Python there are types like integer
00:03:07
integer without decimal part float
00:03:10
number with decimal part for example 2.5
00:03:14
string string ABC and you can
00:03:18
use either double or single
00:03:20
quotes boo Len
00:03:22
boolean True or Falls NAN
00:03:26
is used to represent an
00:03:28
undefined value you can also
00:03:31
check the type of any value using
00:03:33
functions Type
00:03:35
and Let's check the type of number 2 I see
00:03:39
a class Why class because python
00:03:43
is an object oriented
00:03:45
programming language and any value in
00:03:48
python is an instance of a
00:03:50
certain class and here we see
00:03:52
that number 2 is an instance of the class
00:03:54
integer Let's check the type of a
00:03:58
floating point number 1.5 I see fleet
00:04:01
Let's check the type of the string ABC for example
00:04:05
class string Let's check the type of the
00:04:08
value false or True see boolean and
00:04:11
Let's check the type of the value NAN see the
00:04:14
class NAN Type
00:04:16
[music]
00:04:20
You can very easily convert a
00:04:23
value of one type to another using
00:04:26
functions like STR string int
00:04:30
integer float floating point number and
00:04:33
Boolean I can convert to a string
00:04:35
for example the number 100 we get the string 100
00:04:38
also I can convert a
00:04:40
Boolean value to a string for example True I
00:04:43
get the string True Let's convert the
00:04:46
string 50 to an integer I get the
00:04:51
integer 50 Let's convert the
00:04:53
Boolean to an integer value True I get
00:04:56
one and if I convert Falls then of course
00:04:59
I get 0 Let's try
00:05:01
to convert a string
00:05:04
like ABC to an integer and python of course could not
00:05:07
convert such a string to an integer
00:05:09
and I got an error
00:05:15
[music]
00:05:19
in Petunia As in many others in
00:05:22
programming languages ​​there are false values
00:05:24
false value is the value of different
00:05:27
types which are converted to boolean
00:05:30
value false and in python you can
00:05:32
convert any value to
00:05:34
boolean value using
00:05:36
bool function there is following false value
00:05:38
integer 0 during conversion we
00:05:41
get false value false
00:05:44
floating point number 0.0 empty string of
00:05:47
course the logical value false and
00:05:50
NAN
00:05:51
also false are empty values ​​of
00:05:54
container types for example an empty
00:05:57
list or an empty dictionary we will talk about
00:06:00
container types a little later in this
00:06:02
course
00:06:04
[music]
00:06:08
petunia You can Declare new
00:06:10
variables and assign a value to them, it is
00:06:13
customary to call variables lowercase
00:06:15
letters underscores between
00:06:18
words for example may underscore
00:06:20
name Or for example may underscore
00:06:23
fairate underscore dream
00:06:26
If you want to create a constant
00:06:28
whose value will not change
00:06:31
during the life cycle of a
00:06:32
python application you should use capital
00:06:35
letters for example may underscore
00:06:37
API and underscore ki but Please
00:06:40
note that python does not differentiate between
00:06:42
variables and constants and for python it makes no
00:06:46
difference whether you name the variable T-shirts
00:06:49
in upper case or T-shirts in lower
00:06:52
case in both cases you can
00:06:54
later reassign a different value to this
00:06:57
variable But if you name
00:06:59
the variable this way it will be an
00:07:02
indicator for you that you should not
00:07:04
assign a new value to such a
00:07:06
variable
00:07:07
[music]
00:07:11
declaring a variable and assigning a
00:07:14
value to it can be very simple My Name =
00:07:17
Bogdan Now I can
00:07:20
access the value of this variable at
00:07:23
any time I get the string Bogdan
00:07:25
also I can check the type of the variable My
00:07:28
Name I get a class STR string Python
00:07:32
is a dynamically typed language and this
00:07:35
means that you can change the type of
00:07:37
value that is assigned to a variable
00:07:39
For example I can assign a new value
00:07:41
True to the variable My Name and now if I
00:07:45
read the value of the variable My Name I
00:07:47
will get True and now the type of the variable is Bull
00:07:51
This is why you should use a
00:07:53
meaningful name for the variable To
00:07:56
avoid such accidental
00:07:58
reassignment of values ​​if the name of the
00:08:00
variable is My Name then of course you
00:08:03
understand that you should assign a string to
00:08:05
such a variable Let's change the
00:08:07
value of this variable back to
00:08:09
Bogdan If you want to for example
00:08:11
assign a boolean value to a
00:08:12
variable You should call
00:08:15
accordingly, for example, a suitable
00:08:17
name would be from loc-in for a
00:08:20
variable that tracks
00:08:22
whether the user is logged in
00:08:25
[music]
00:08:29
You can also copy variables
00:08:32
for example name can be a copy of My Name
00:08:35
and now if accesses
00:08:38
adoraname I get Bogdan if I
00:08:41
access minname I also see
00:08:43
Bogdan if I assign a different value to the
00:08:45
variable say Mike and access I
00:08:51
will see the value Mike But if I
00:08:54
access Miami it still contains the
00:08:56
value Bogdan and that means that with
00:08:59
basic types When you copy one
00:09:01
variable to another and change the value of the
00:09:03
other variable, the value of the original
00:09:06
variable such as My Name does not
00:09:08
change and This is due to the fact that when
00:09:11
copying a variable containing the
00:09:13
value of the base type, the
00:09:15
values ​​​​from one variable
00:09:17
to another are actually copied and therefore when we changed
00:09:21
the value of the atername variable in this
00:09:23
line, the value of the My Name variable did not
00:09:26
change
00:09:28
[music ]
00:09:31
Now let's define a new
00:09:34
variable and Let's call it H its
00:09:37
value will be the integer 21 and now
00:09:40
let's assume that you want to
00:09:42
increase the value of this variable H by
00:09:44
one You can do it
00:09:47
like this H assignment sign H + 1 we are
00:09:51
actually using the current value of the
00:09:53
variable H and increase it by one and
00:09:57
then assign the new value to the same
00:09:59
Edge variable after that the value of the
00:10:01
Edge variable will become 22 You
00:10:04
can also Perform the same operation
00:10:06
using the operator plus equals and Let's
00:10:09
assume that now we want to
00:10:11
increase the value of the variable H2 H plus
00:10:14
equals 2 no need two different
00:10:16
operators You can use only
00:10:18
one operator plus equals and now
00:10:20
the variable H contains the value 24
00:10:23
in the same way you can reduce the
00:10:26
value of a variable using the operator
00:10:28
minus equals H minus equals say 5 and
00:10:32
now H is equal to 19
00:10:34
Also you can assign NAN as the
00:10:37
value of any variable A also you
00:10:40
can delete a certain variable
00:10:41
using the Dell operator and now
00:10:44
there is no such variable
00:10:46
[music]
00:10:50
we have already discussed the basic types like
00:10:52
string or integer and now it’s time
00:10:55
to talk about container types in python
00:10:57
there are such container types Like a sheet
00:11:01
Table
00:11:05
is an unordered sequence of
00:11:08
values
00:11:10
are ordered let's start with lists you
00:11:14
can create a list using
00:11:16
square brackets and here is an empty list You
00:11:20
can assign an empty list to any
00:11:22
variable for example now variable A
00:11:25
contains a list and now it is empty You
00:11:28
can check the length of the list using a
00:11:31
function and now the length of the list is zero there
00:11:34
is none in it element as an
00:11:37
instance of a list has many different
00:11:40
methods that you can call
00:11:42
using dot notation if you type A
00:11:45
and put a dot and press twice you
00:11:47
will see what methods are available for
00:11:49
use
00:11:50
such as methods upend copies Count Clear
00:11:53
and so on the opent method is used to
00:11:57
add new elements to an
00:11:59
existing one list Let's try Hey
00:12:02
dot opent And let's add the number 2
00:12:04
now in the list A there is one element and
00:12:08
now the length of this list is 1 Let's
00:12:11
add another element to this list and
00:12:13
add for example the string ABC and after
00:12:16
that the list A already contains two different
00:12:19
elements and accordingly the length A
00:12:22
of course 2 You can access a
00:12:25
specific element of a list using
00:12:27
its index, with indices starting from
00:12:30
zero i.e. the index of the first element is 0 And
00:12:33
the index of the second element is 1 To
00:12:35
access elements of a list,
00:12:37
square brackets are used for example and square
00:12:40
brackets 0 I get 2 This first element
00:12:42
in this list It has index 0 Let's
00:12:45
read the second element and now instead of 0 it
00:12:47
will be 1 I get ABC But if I
00:12:50
try to access a
00:12:52
non-existent element for example
00:12:53
Let's specify index 10 here I will get
00:12:56
index error index out of range
00:12:59
Let's add another element in this
00:13:02
list is apend by the way you
00:13:05
can always use Tempo to
00:13:06
autocomplete for example the name of the method
00:13:08
that you want to use and here
00:13:11
Let's add the element True this is a
00:13:13
boolean value now the length of the list
00:13:15
will be 3 and let's say you want to
00:13:17
access the last element in
00:13:19
this list for this you can
00:13:21
use syntax like hey
00:13:23
square brackets minus 1 negative
00:13:26
indices like -1 -2 allow you to
00:13:29
access elements starting from the
00:13:31
end of the list now there are three
00:13:35
different elements in the list If you want to remove the
00:13:37
last element in this list you can
00:13:39
use the method
00:13:41
without any arguments it
00:13:44
returns the element which was
00:13:46
just removed and now has only two
00:13:48
elements also remove all elements from the
00:13:51
list Using the Clear method and now
00:13:53
the list is empty now Let's delete the
00:13:57
variable
00:13:58
[music]
00:14:03
lists are mutable in python that is the
00:14:05
reason we were able
00:14:08
to change the value of variable A
00:14:10
previous examples also have an
00:14:12
immutable container type called
00:14:15
Table Let's create a new variable
00:14:17
B and to the right of the assignment sign we write in
00:14:20
parentheses for example 2 and ABC press
00:14:25
Enter and Let's access we see
00:14:28
two Elements 2 and ABC and the type tapu If I
00:14:34
now write by dot and twice I press
00:14:36
Tap I will see only two available methods
00:14:39
for taple which you can use
00:14:41
count and index there are no methods
00:14:44
like upend or pop and the difference between
00:14:48
tapple and sheet is that
00:14:50
tapple is immutable you cannot
00:14:53
add new Apple elements For example
00:14:56
even if I try to enter
00:14:59
bynd and I'm leading here for example 10 I'll get
00:15:02
an error the Table object doesn't have an
00:15:06
apend attribute but you can access
00:15:09
elements in a Table the same way we did
00:15:11
with lists using
00:15:13
square bracket notation Bi square
00:15:15
brackets 0 and I see two This is the first element
00:15:19
in the taple with index 0 Similarly I can
00:15:22
access the second element with
00:15:24
index 1 we see the row ABC also
00:15:27
Using the Index method you can get the
00:15:29
index of a particular element for example the
00:15:32
index of the row abc-1 I recommend you to
00:15:35
use
00:15:36
Table when you need to create an
00:15:38
ordered list with different values
00:15:40
and you do not plan to change these values
00:15:43
or adding a new value in the future
00:15:46
That's what tapala is best for
00:15:50
[music]
00:15:54
Let's move on and on Let's
00:15:56
discuss unordered container types
00:15:58
dictionaries and sets and let's start with
00:16:01
dictionaries dictionaries are created using a
00:16:03
pair of curly braces with
00:16:06
key value pairs inside them Let's
00:16:08
add Q1 with the value True and kitu with the
00:16:13
value let's say 10,
00:16:15
I note that the order of the keys in the dictionary does not matter,
00:16:19
you can enter Q1 and after
00:16:22
it kitu, or change the order and
00:16:25
first enter kitu with its value and
00:16:28
then Q1 with the value True Okay,
00:16:31
let's create a new variable and
00:16:33
call its Person and assign it a dictionary
00:16:36
with one key name whose value
00:16:38
will be a string for example Bogdan if I
00:16:42
get access now I will see a dictionary with one
00:16:44
key name and the type of the variable is of course
00:16:48
now a dictionary
00:17:48
And now I get the string NAN you
00:17:53
can also assign a default value by
00:17:55
calling this function if a certain
00:17:57
key is not present in the dictionary using the
00:18:00
following syntax sail dot Get
00:18:03
Age and here after the comma the
00:18:05
default value for this key is specified
00:18:07
for example 18 And now I see 18 as the
00:18:11
result of calling this function So
00:18:13
if you are not sure whether a
00:18:15
specific key is present in the dictionary or not I I
00:18:17
recommend that you use the Get method
00:18:19
instead of square brackets, when
00:18:21
using which you will receive a
00:18:23
key error. If a certain
00:18:26
key is not in the dictionary. Now let's
00:18:28
check what methods other than Get are available
00:18:30
for use for the Person dictionary.
00:18:32
Let's write a dot and press
00:18:36
type twice and here you can see methods such as Clear
00:18:39
Kiss or velos but unfortunately
00:18:42
dictionaries don’t have such a method as append then
00:18:46
how can we add new keys
00:18:48
very simply using square brackets
00:18:52
we will write proston and here in square
00:18:55
brackets we will indicate the line with the new key and
00:18:57
say Happy and the value of this key
00:18:59
will be True now I will see in the Person dictionary
00:19:02
two different keys name and Happy
00:19:06
Also you can always change the value of a
00:19:09
certain key using the same
00:19:12
notation Let's change the value of the
00:19:15
Happy key for example to false and now
00:19:17
the value of the Happy key is false let's
00:19:21
change Natra back you can also
00:19:23
get the length of the dictionary using the
00:19:26
LAN function call it Land parson I see two
00:19:31
now this dictionary has two different
00:19:33
keys using parrotion.kz and
00:19:37
parson.vlius you can get the keys and
00:19:40
values ​​of a specific dictionary Let's
00:19:43
first try sail dot Kiss as
00:19:46
a result I get the dictionary keys and
00:19:50
here you see a structure that is very
00:19:52
similar to a list with two elements name
00:19:55
and Happy but this result is not a list it is an
00:19:58
instance of dickkiss Let's check this
00:20:02
using the Type function and here it will be Pro
00:20:04
Kiss I see a class
00:20:07
you can always convert dickkiss
00:20:11
to a list If necessary using the
00:20:13
list function Person Kiss And now I see a
00:20:17
list with two elements name and Happy
00:20:20
in the same way you can get the
00:20:22
value of the dictionary keys
00:20:25
parason.vels And now I see dictated with
00:20:29
two elements Bogdan and True
00:20:32
in the same way you can convert
00:20:34
it into a list using a sheet and here there
00:20:37
will be proso.vels And now you can see a list with
00:20:40
two elements Bogdan and True I remind you
00:20:43
that in lists you can get a
00:20:45
specific element using an annotation with
00:20:47
square brackets For example, I can
00:20:50
get the first element by adding
00:20:51
square brackets and there will be 0 and I
00:20:55
see of course Bogdan also the value in the
00:20:57
dictionary can have container types
00:20:59
for example a list or a dictionary Let's
00:21:02
add a new key to the sail dictionary
00:21:04
using square brackets and here it
00:21:06
will be Let's say hobbies and the value will be
00:21:09
a list and here we use square
00:21:12
brackets and here in the list I will write axlebox and
00:21:15
Snowboarding now parason list a
00:21:18
new key hobbies has been added Let's
00:21:20
check this and now in this
00:21:23
perosson dictionary there are keys name Happy and hobbies
00:21:25
and now If you want, you can change
00:21:28
this list or add new elements
00:21:30
or delete elements or change
00:21:32
elements using syntax such as
00:21:35
Person square brackets hobbies and then
00:21:39
we will use the pop method and delete the
00:21:42
last element in this list So the
00:21:45
element Snowboarding was deleted and now
00:21:48
remains in the list only one element
00:21:50
You can also remove a specific key from the
00:21:52
dictionary using the operator that is
00:21:56
wassin.dl and here you in square brackets
00:21:59
will be the name of the key for example hobbies and the key
00:22:03
hobbies was just deleted
00:22:06
[music]
00:22:10
now the parason variable is
00:22:12
a dictionary And what if I want to copy
00:22:15
this dictionary to another variable
00:22:17
for example
00:22:20
let's make it
00:22:25
have the same value as sail
00:22:28
now Let's try to change the
00:22:31
variable to droperson and for example
00:22:33
Let's change the name
00:22:37
square brackets name and change the name for
00:22:40
example to Bob Now the name in parason
00:22:45
has been changed to Bob But if I try
00:22:47
to access to Person I will see that the name
00:22:50
has also been changed here to Bob and the
00:22:53
reason for this is that the python dictionary
00:22:55
is a reference type and now both the
00:22:58
variables Sails and Nad Porosson
00:23:00
actually point to the same
00:23:02
place in memory, the place where
00:23:05
this dictionary is located
00:23:07
And when you change In other words,
00:23:09
you mutate this dictionary, changes
00:23:12
occur only in one place in memory
00:23:14
to which the variables continue to be pointed by
00:23:17
the sail and the analogues of the sleep
00:23:20
That is why here we see the same
00:23:23
value This is called copy by
00:23:26
reference
00:23:27
when copying values ​​of the base type
00:23:29
for example strings or boolean values
00:23:32
are copied actual value from one
00:23:34
variable to another with dictionaries
00:23:37
the situation is reverse we copy only
00:23:40
pointers which is very important to always remember the
00:23:43
same applies from lists Let's
00:23:46
create a list for us simply with numbers
00:23:48
for example one and two and then copy to the
00:23:53
ambrosia you variable nabrus like this
00:23:57
and now let's add more one
00:23:59
element in the list numbrus Using the
00:24:02
opent method and Let's add a number for example 3
00:24:05
I see that it is given the image and numbros are
00:24:09
the same and the reason here is the same as
00:24:12
for dictionaries the list is also a reference
00:24:16
type in python and here in this line we have
00:24:19
copied only the reference and not the
00:24:22
actual value is the
00:24:24
same value for both variables We
00:24:27
just need to sketch So this is what is
00:24:30
called copying by reference and
00:24:31
please always Be very
00:24:33
careful When you copy the value of
00:24:35
types like dictionary or list
00:24:38
[music]
00:24:41
Now let's look at another
00:24:44
container type in python which
00:24:46
is called a set set sets are created
00:24:49
using curly braces like
00:24:51
dictionaries but the set does not have keys with
00:24:54
values ​​like dictionaries instead the
00:24:57
set consists of elements and Each
00:24:59
element must not be mutable this
00:25:02
means you cannot insert the
00:25:05
set into other dictionaries or lists for example a
00:25:08
set can contain the following elements
00:25:12
10 Now let's assign such a
00:25:15
value to a variable like myset and
00:25:18
now let's look at the type of this
00:25:20
variable and I can see that myset is
00:25:23
an instance of the class Set Now let's
00:25:26
see what methods are available for the
00:25:28
variable myset I'll press Tap twice here
00:25:31
and I'll see many methods like
00:25:34
copy difference from sapset and so on in
00:25:40
sets there are even more than dictionaries But how
00:25:43
sets are actually different from
00:25:45
dictionaries Let me show you
00:25:47
Let's try adding another
00:25:50
element to myset which currently
00:25:52
only has three elements abc-10 and B
00:25:56
Note that the order of these elements
00:25:57
here in this output is different from the
00:26:00
order in which I initially added
00:26:02
the elements when I assigned the value to the
00:26:04
myset variable the order was ABC B and 10
00:26:07
but here in this output I see ABC 10b
00:26:10
This means that the order in sets
00:26:13
does not matter as in dictionaries Let's
00:26:16
try adding new elements in
00:26:18
myset there is a method for this Let's
00:26:21
add a new element True read
00:26:24
the value of the myset variable and now there are
00:26:27
already 4 elements in the set Let's add
00:26:29
another element for example the number 20 and
00:26:31
now there are 5 elements in the set But if I
00:26:34
try to add an element that
00:26:36
is already in the set for example Let's add
00:26:38
the number 10 I will see that the set has not changed And there are
00:26:43
still only Five elements in it and
00:26:46
this is what makes sets unique in
00:26:49
Python the set contains only unique
00:26:51
values ​​and does not add duplicates and In
00:26:55
some cases this characteristic of
00:26:56
sets can be very, very
00:26:58
useful sets do not keep duplicates
00:27:01
You can of course remove certain
00:27:04
elements from a set Using the and method
00:27:07
Let's remove the number 20 and it was
00:27:10
successfully removed from the set
00:27:13
[music]
00:27:16
Now let's briefly summarize
00:27:19
container types in python let's start with a
00:27:22
list lists are created using
00:27:24
square brackets and in they can contain
00:27:26
elements of different types, for example, integer
00:27:29
boolean or string, this is a list, then there is
00:27:34
tapple, created using a pair of
00:27:36
parentheses, and here there can be the same elements
00:27:38
as in the first list, one True and ABC,
00:27:42
there are also dictionaries that are created
00:27:45
using curly braces and dictionaries
00:27:48
contain pairs of key values ​​for example
00:27:51
in a dictionary can be kiwan with the value 1
00:27:54
and tu with the value string ABC also there are
00:27:59
sets created also using a pair of
00:28:02
curly braces but sets have only a
00:28:04
value for example one and ABC the difference
00:28:08
between these four types is
00:28:10
that the list of stages is ordered and
00:28:15
any an element in the list of steps has its own
00:28:18
unique index the index starts from
00:28:21
zero the index of this element is 0
00:28:24
the index of this element is 1 and so
00:28:26
on the difference between a list and steps is
00:28:29
that lists can be
00:28:32
changed You can change any
00:28:35
value add new elements delete
00:28:37
elements and so on on the other hand
00:28:39
the value of taple type is immutable and you
00:28:42
cannot change these values ​​and also in
00:28:45
tapple you cannot add or
00:28:47
remove elements dictionaries and sets are not
00:28:49
ordered in python the order of the keys
00:28:51
here does not matter as well as
00:28:54
the order of the elements in the set and you can
00:28:57
access to any element in
00:28:59
the dictionary by key, for example using the
00:29:02
k1 or kitum key, and you can also add
00:29:06
new keys if necessary
00:29:10
using the Dell operator. You can
00:29:12
delete a specific key from the dictionary. This
00:29:15
means that dictionaries and sets are modifiable
00:29:18
in Python. You can change the set,
00:29:20
add new elements, delete elements.
00:29:23
and so on the
00:29:25
difference between a set and a list is that a
00:29:28
list can contain the same
00:29:30
value and a set can only contain a
00:29:33
unique value and if you
00:29:36
try to Add a new element
00:29:37
for example ABC this set will not
00:29:40
change anything and the set will still
00:29:42
contain only two elements one and ABC
00:29:45
in This is the difference between the four different
00:29:48
container types Lis and
00:29:53
Now let's exit the interactive
00:29:56
python shell by calling the Exit function and
00:29:59
we will spend the rest of the course in the
00:30:01
Visual Studio Code editor and then we
00:30:04
will talk about the functions of instructions and fls and
00:30:07
other functions of python
00:30:08
[music]
00:30:12
in the rest of the course we will
00:30:14
use the code editor Visual Studio
00:30:17
Code because we will be creating
00:30:18
multi-line code blocks in python and
00:30:21
running it and therefore it is not recommended to
00:30:23
continue working in the interactive
00:30:25
shell and if you do not have vscout installed on your computer
00:30:27
I highly
00:30:29
recommend installing it because we
00:30:32
will be using one of its
00:30:33
extensions which will allow us to
00:30:35
automatically execute the code using a
00:30:37
keyboard shortcut or a code run button
00:30:39
because if you don't have vscout
00:30:42
please download it dot Visual
00:30:45
studiocode.com Install And after that
00:30:47
please open a terminal on your
00:30:50
computer and Let's create a folder for
00:30:53
our project I will do this on the
00:30:56
desktop And I will create a folder called
00:30:58
pythones
00:31:01
Let's go to this newly created
00:31:04
folder and Let's open it using the
00:31:06
Cold command
00:31:08
If in your case this command is
00:31:11
not available You can open vscold
00:31:14
manually and from the menu select the file Open and
00:31:17
open this newly created folder but I
00:31:20
will open it using the Cold command in
00:31:23
the terminal So the project has been opened I
00:31:26
will expand the application to full screen and
00:31:28
also I will close this welcome page
00:31:30
Now let's create new files
00:31:33
here in this folder Python clashcores for
00:31:36
this Click on this icon and Let's
00:31:37
call the file main.pi Let's close this
00:31:41
left panel and Let's write the Python code
00:31:43
right in this file main.ua for example
00:31:47
Let's write Print and in brackets there will be
00:31:50
Hello From Python Let's save
00:31:52
the changes and now the question arises how
00:31:54
to run this Python application right
00:31:57
here viscope we can do it
00:31:59
manually by going to term menu and selecting
00:32:02
New Terminal the new terminal was opened and
00:32:05
you noticed that now you are in the
00:32:07
Python clashcores folder so here
00:32:09
enter Python and the file name you
00:32:12
want to run main.ui you need to
00:32:15
enter this command If you are using
00:32:17
Windows or Linux If you are running
00:32:19
on Mac please Change Python to
00:32:22
Python Free Let's press Enter and python
00:32:25
will execute the specified file and here is the result of
00:32:27
executing this file main.ui Hello
00:32:31
From pite but enter this command Every
00:32:33
time we want to execute the code it is not
00:32:36
very convenient so for simplicity
00:32:38
Let's install one of the extensions
00:32:40
vscout which is called Cold Runner and
00:32:44
with the help we can execute this code
00:32:47
much easier and faster
00:32:49
using a key combination or this
00:32:51
button Let's go to the extension and
00:32:54
here in the search enter Call droner
00:32:56
select Call 2 and click Install Cold
00:33:01
Warner was successfully installed and if you
00:33:04
Scroll a little down in the description you
00:33:06
will find how to run it Let's find the
00:33:09
key combination Here it is in this section
00:33:11
to run the code You can
00:33:14
use the key combination Control
00:33:16
alt-n or use this button
00:33:18
here Let's go to the main.ua file and
00:33:22
first Let's press this button and
00:33:24
select runcold and here I see the result of
00:33:27
executing this file with I see
00:33:31
sections like this but I don’t want to
00:33:34
see them every time I run this
00:33:36
program with
00:33:38
and so I will show you how to change these
00:33:41
settings so that these messages are also removed from the output
00:33:44
we will clear the
00:33:46
previous output Every time we
00:33:48
run the genre again also
00:33:51
Note this line on my
00:33:53
computer the Python interpreter was used
00:33:55
If you are a
00:33:58
Meg user I will show you how to change concrete to
00:34:01
python 3 Let's open the Cold
00:34:03
preferences settings or by pressing the
00:34:05
combination Control comma or commands
00:34:08
comma and enter Code Wonder in the search and
00:34:11
you will find coldroneer settings that
00:34:13
contain the text Cold wanner in the title
00:34:15
or description and Let's refine the search by
00:34:18
adding Save here and you will find two
00:34:21
options
00:34:22
Save all files by restarting and
00:34:24
save the file by restarting I will choose the
00:34:27
second option And when you you will
00:34:29
run any file using then it will
00:34:32
first automatically save the file and
00:34:35
then execute the code Now let's
00:34:38
find Clear here and check the box here
00:34:40
to clear previous output now write
00:34:44
message here and you will see the show execution
00:34:47
message Let's uncheck this box and
00:34:51
if you are a Mac user
00:34:53
enter also here in search exec And you
00:34:57
will find Call oner executer
00:35:00
and You need to open the file from these dot
00:35:03
Jason and change the Python interpreter in it
00:35:06
please click here Edit in
00:35:09
settings.json Find the Python option and
00:35:12
Change Python to Python 3 and save the
00:35:16
changes in this settings file. js So
00:35:20
now we are all set Let's
00:35:22
try to execute the main.pi file again
00:35:24
click here Run Cold And now I
00:35:28
only see the text Hello From Python if I
00:35:32
change the file and add an exclamation mark here for example
00:35:33
and save the changes to
00:35:36
the file I will run its words Run Cold I will see
00:35:39
that the previous output has been cleared Also you
00:35:43
can use the Control
00:35:45
alt-n combination to execute the code faster
00:35:47
Let's change the files again and press
00:35:50
this Control alt-n key combination and you
00:35:52
will see the updated result here with
00:35:55
two exclamation marks Also you
00:35:58
can change the position of the term now by
00:36:01
default it is under the file and
00:36:04
if you want to move it to the right
00:36:06
You can right-click
00:36:08
here and select move panel
00:36:10
to the right and now the terminal is
00:36:12
here to the right of the file for me this is more
00:36:14
convenient So everything is already configured Cold
00:36:17
Runner is installed and any time
00:36:20
you want to run the code you need to press the
00:36:22
key combination Control alt-m
00:36:25
[music]
00:36:29
we have successfully installed and configured the
00:36:31
Cold wanner extension and we are ready to
00:36:33
continue the next topic functions in
00:36:36
python functions are created using the
00:36:39
Def keyword followed by the name of the function
00:36:42
for example My Name followed by a pair of
00:36:45
parentheses and in them You can specify
00:36:48
the parameters of the function, let's not
00:36:51
add parameters for now, after that there is
00:36:54
a colon and on the next line after
00:36:57
the tap Please note that the tap was
00:37:00
added automatically You can
00:37:02
add the body of the function with instructions Let
00:37:04
's write here just the
00:37:07
keyword pass and then below Let's call
00:37:11
this function My Name using
00:37:14
parentheses and let's run this code the code was
00:37:18
executed but here in the output I don't
00:37:21
see anything Let's try to print the
00:37:23
result of calling this function using
00:37:28
My N like this now let's run the code again and
00:37:32
now here I see NAN and this result
00:37:35
is returned by the function My Name is the
00:37:39
Pass keyword here doesn't actually
00:37:41
do anything and you can use
00:37:44
such a keyword in the function body
00:37:46
when the function does not contain any code But you
00:37:49
need to add at least one line of code
00:37:51
in the function body so in that case you
00:37:54
should use PAZ so that the
00:37:56
function body is not empty Now when
00:37:58
a function is declared we can call
00:38:00
multiple times For example I can copy
00:38:02
this line and call it again And now
00:38:05
I see on Twice So Now this
00:38:07
function My Name has a name but does not have
00:38:10
any parameters and by default
00:38:12
the function returns NAN if there is no
00:38:15
statement Let's add the string he
00:38:18
instead of pass and Let's return for example
00:38:20
the number 10 like this if I run
00:38:24
the application now I will see the number
00:38:27
10 twice this is how you can return a
00:38:30
specific value from a function
00:38:31
Using the Return keyword Now
00:38:34
let's add parameters to the function My
00:38:37
Name the parameters of the function are added here
00:38:39
in parentheses and Let's add the
00:38:41
name parameter Now we can call the
00:38:44
My Name function with an argument I can
00:38:47
add an argument here for example Bogdan
00:38:50
And in the next function call I can
00:38:52
add another argument for example Bob and
00:38:56
now let the function return name
00:38:58
instead of the number 10 Let's
00:39:01
run the application again after these changes And
00:39:03
now I see Bogdan and Bob as
00:39:06
the results of a function call
00:39:08
Note that this is a parameter And these are the
00:39:11
arguments here argument and here
00:39:14
argument Every time you call
00:39:16
a function you pass different arguments
00:39:20
also Note that if you do not
00:39:22
specify an argument for example Here you
00:39:25
will get the error missing required
00:39:27
positional argument and in this case you
00:39:31
can assign a default value
00:39:33
for a certain syntax parameter
00:39:35
next after the parameter we add an
00:39:38
equal sign and here there can be a default name
00:39:41
for example No Name specifite like
00:39:43
this let's now run the application and
00:39:47
now for this function call I see
00:39:49
Bogdan And in this calling the function I see
00:39:51
noname spicefight because now
00:39:55
this function parameter has a
00:39:58
default value No Name spicefight this is the
00:40:01
default value for the name parameter
00:40:04
actually inside this function this
00:40:07
name parameter is a variable and
00:40:10
you can perform various actions with
00:40:13
such a variable for example instead of
00:40:14
returning name we we can return
00:40:17
name.app and call this method like this,
00:40:19
let's now run the application and
00:40:22
now here I see Bogdan and noname
00:40:24
special in uppercase because
00:40:27
here on this line we called apr the
00:40:30
variable name contains a string And each
00:40:33
line is an instance of the class
00:40:34
string A in the class string there are many
00:40:37
methods available including Apple so we can
00:40:40
call it using dot rotation
00:40:42
like this also inside the body of the function You
00:40:45
can perform some actions
00:40:47
for example Here Let's display the terminal
00:40:48
name valve is And after the comma we write
00:40:52
name Now let's run the application
00:40:55
and here I see name Welly from Bogdan What
00:41:00
is the result of this expression
00:41:02
then I see Bogdan What is the
00:41:05
result of the function call that we
00:41:07
print here on this line then I
00:41:10
see name Wild is No Name specified this is the
00:41:12
result of the Print function call inside the
00:41:14
My Name function and at the end we see
00:41:16
the noname specific in upper case that
00:41:20
is returned function My Name in this
00:41:22
function call This means that the
00:41:25
Python function can do some
00:41:27
things like we did for example in this
00:41:28
line return a result like we
00:41:31
did here in this line also
00:41:33
Note that if you do not
00:41:36
use ration inside the function body
00:41:37
then any function does not explicitly return NAN
00:41:40
and this is what we saw at the beginning of this
00:41:43
lesson
00:41:44
[music]
00:41:48
now Let's delete this function and
00:41:51
let's define another function again
00:41:54
using the DF keyword And the name of the
00:41:56
function will be Person underscore
00:41:58
info and here in the parameters section
00:42:01
Let's add two parameters and H followed by
00:42:05
a colon and on the next line there will be
00:42:08
the body of the function. Please note that if
00:42:10
you try to write a function block without
00:42:12
indentation, for example, let's
00:42:15
run the code like this, you will see an error: indentation
00:42:19
expected code block with indentation
00:42:22
because Python, with the help of indentation, actually
00:42:25
understands where the body of the function begins,
00:42:27
so you should always add
00:42:30
here indentation and if I run the code now I wo
00:42:33
n’t get any errors. So let’s now
00:42:36
display age and name in the terminal info
00:42:42
in the next line
00:42:46
below Let’s call a function
00:42:48
with two arguments for example Bob and 25
00:42:53
Let’s run the application and here in
00:42:55
the output I see Bob and the number 25 This
00:43:00
means that at the time this
00:43:03
function was called, the name parameter was assigned
00:43:05
the value Bob and the H parameter was given
00:43:08
the value 25 and these arguments here in this
00:43:12
function call are called positional
00:43:15
arguments if I change the order here
00:43:18
and For example, if I pass the first 25 and the
00:43:21
next Bob I will receive another the result is
00:43:24
25 this will be the name H will be Bob and this is of
00:43:29
course not what you expect from this
00:43:32
function This means that with positional
00:43:35
arguments the order is important so when
00:43:37
you call the sailsinfo function and
00:43:40
add a couple of parentheses without Scott will
00:43:44
actually show you what arguments
00:43:46
are
00:43:47
expected first the argument is name Here
00:43:50
you can see that name is underlined if
00:43:53
I type Bob and add a comma I can see that
00:43:56
now I need to add H as a second
00:43:58
positional argument
00:44:00
[music]
00:44:04
but also in python you can use
00:44:07
keyword arguments like this
00:44:10
name next equal sign Bob comma
00:44:15
next equal sign 25 Let's now
00:44:19
run this code and I can see that the function
00:44:21
Was executed and here is the expected result
00:44:24
namebop and h25 And now I can change
00:44:29
the order of these named arguments like this,
00:44:31
first H will be the value 25 and the
00:44:35
next one will be name with the value Bob
00:44:40
Let's now run the application and
00:44:43
the result is the same this means that with
00:44:46
keyword arguments where we
00:44:48
explicitly specify the parameter name the order of
00:44:50
the arguments does not matter if you
00:44:54
want you can even mix
00:44:56
positional Arguments and keyword arguments
00:44:58
for example first would be
00:45:00
Let's say Bob Let's remove this
00:45:03
keyword argument name and
00:45:05
Let's pass Bob through a positional
00:45:08
argument he will be the first and the next one
00:45:11
will be the keyword argument Let's
00:45:13
now run the code and the result is the same
00:45:15
Bob and 25 This means that you can
00:45:18
mix positional Arguments and
00:45:21
named arguments
00:45:23
[music]
00:45:27
Now let's create another function
00:45:30
and call it will be allowed by Dev Sam himself and
00:45:34
here there will be, say, two parameters A and B and
00:45:38
I want to return the sum a/b Like this and
00:45:43
Let's call this function below and
00:45:46
Let's print the result of the
00:45:48
function call to the terminal here it will be itself with
00:45:51
two arguments 5.2 Let's now
00:45:53
run the application and I get 7 output
00:45:57
And if I want to sum up all the arguments
00:46:00
that are passed to a function call
00:46:02
for example 5 2 10 15 and so on if I
00:46:07
try to run the application now I
00:46:09
will get an error like itself Accepts two
00:46:12
positional arguments but were passed 4
00:46:15
this is logical here we specified only two
00:46:18
parameters but we have passed four
00:46:20
arguments and it leads to this error
00:46:23
in python but how can we solve this
00:46:26
problem that if I want to call a function
00:46:28
with any number of arguments and here
00:46:31
inside the function I want to sum all the
00:46:33
passed arguments for that inside the
00:46:36
parameters section I can use the
00:46:38
following syntax star arks and
00:46:42
now let's print terminal arks
00:46:45
like this let's see what we get
00:46:47
in the output and I see a tapa with the values ​​5 2
00:46:51
10 and 15 this means that now we can
00:46:54
call this function itself with any
00:46:57
number of arguments
00:46:59
using this syntax in the
00:47:01
parameters section this is a variable arks will be
00:47:03
defined inside the function and it will
00:47:06
actually contain all the arguments
00:47:08
that were used in the function call
00:47:11
Let's also print the type of the variable
00:47:14
arx like this, run the code and I see the
00:47:18
tattoo class here
00:47:19
[music]
00:47:23
And now I can iterate through all the values
00:47:26
in arks and sum everything values ​​of numbers
00:47:29
and Let's get started with this but
00:47:32
first Let's declare a new variable
00:47:34
Total its initial value will be
00:47:37
zero
00:47:39
Now let's iterate over the Arguments and you
00:47:42
can iterate using a loop
00:47:45
for ark in ark colon and here Let's
00:47:49
do the following operation Total plus
00:47:52
equals and at the end Let's return Total
00:47:55
soon I'll explain to you what's happening here
00:47:58
But now let's Just run this
00:48:00
code and I can see the result 32
00:48:03
So what's happening here here in
00:48:07
this line we're iterating over the arguments
00:48:09
each value of the container type
00:48:11
is irable We just saw
00:48:14
here that arx is the floor research we
00:48:17
we can iterate over the elements of Table and
00:48:19
Let's output it here inside the for loop,
00:48:22
let's say in the terminal just And let's
00:48:26
run the code I see 5 2 10 15 and at the end
00:48:30
I see 32 What is the result of calling
00:48:32
this function and this means that inside the
00:48:35
for-in loop there is a variable with the name
00:48:38
exactly in the loop this variable
00:48:40
is defined and we can perform
00:48:42
some actions with such a variable in
00:48:45
this example it is an integer and in this
00:48:48
line we simply add Edge to the
00:48:50
value of the Total variable which was
00:48:53
declared here before forin using the
00:48:56
plus equals operator And after this
00:48:58
for in loop the value of the Total variable will
00:49:01
contain the sum of all arguments and
00:49:04
therefore here when we return Total
00:49:06
we get the sum of all arguments
00:49:08
passed in this function call if I
00:49:11
delete this line and add for example
00:49:13
another element here Let's add 10 and
00:49:16
run the application we will get 42 and it doesn’t
00:49:20
matter Which number of
00:49:22
arguments Here you pass in this
00:49:24
function call they will all be
00:49:25
summed here in this for loop
00:49:29
[music]
00:49:33
now let's talk about keyword arguments
00:49:35
Let's remove everything from
00:49:38
here and Let's declare the function
00:49:40
info again here we'll add two
00:49:43
parameters again and Let's print out the terminal
00:49:46
name.h like this, let's call this
00:49:50
info function below with two arguments Bob and
00:49:54
25 as we did before and Let's
00:49:57
now run the applications again and I
00:50:00
will see Bob and 25 in the terminal But what if
00:50:03
you want to specify a variable
00:50:05
number of parameters here and not just two for
00:50:07
example, and let's say that you want
00:50:11
to extend this function and add other
00:50:13
parameters, for example, city, country, hobby, and
00:50:17
so on, well, not all calls to the function
00:50:20
must have all the Arguments and you
00:50:23
want to be able to call this
00:50:24
function, say, with only two
00:50:26
arguments, name and age, but in
00:50:29
some cases you want to pass
00:50:31
more arguments for example
00:50:33
age age and city how to perform
00:50:35
such tasks You can use KW
00:50:39
arks and the following syntaxes Two
00:50:42
asterisks arks Like this, let's
00:50:46
display the arks terminal here and run
00:50:48
the application
00:50:50
and I now get in the terminal an error of
00:50:53
type
00:50:54
takes 0 positional arguments but
00:50:58
was passed two This means that with
00:51:01
this syntax in the parameters section
00:51:03
you are not allowed to use
00:51:06
positional arguments because in this
00:51:09
function call
00:51:10
you must only use
00:51:12
named arguments or keyword arguments
00:51:16
let's change the
00:51:19
positional arguments here named
00:51:21
arguments here will be name And here will be
00:51:24
H like this let's now let's run the
00:51:27
application And now in the output I see a
00:51:30
dictionary with two keys name with the value
00:51:33
Bob and H with the value 25 This means that
00:51:37
when using named arguments
00:51:39
and two asterisks before arks the arguments are
00:51:42
converted to a dictionary Let's
00:51:45
make sure something is a dictionary Let's
00:51:47
output Type arax and run the application and
00:51:50
Yes, we see the dictionary class here and now
00:51:53
here inside this function You can
00:51:55
work with the Ax variable just like you
00:51:58
work with any dictionary
00:52:00
You can access the keys You
00:52:02
can add new keys You can
00:52:04
change the value of the keys and so on For
00:52:06
example, you can print arx square
00:52:09
brackets name and now you will get
00:52:12
the value of the key name in this dictionary and in
00:52:16
this example this is Bob
00:52:18
also Let's add here for example a
00:52:20
city let's say Paris and now I can
00:52:24
access this city like this
00:52:27
let's run the code and I will see in the
00:52:30
terminal Paris but what if the city
00:52:33
is not passed here as a named
00:52:35
argument what will I get I will get an error
00:52:38
error this is a network key error and this is
00:52:42
what we discussed earlier If you
00:52:44
try to access a
00:52:46
specific key in a dictionary
00:52:47
using square brackets and
00:52:49
that key is not in the dictionary you will get a
00:52:51
Key error if the key may
00:52:54
be present Or maybe not You should
00:52:57
use the method Like this arks.g and
00:53:01
here it will be for example networks if I execute
00:53:04
the code Now I will see the output One because
00:53:06
this is the value that is returned by the
00:53:08
Get method if the abandoned key
00:53:11
is not in the dictionary And now in this
00:53:13
call function there is no named
00:53:15
network argument and therefore in the arks dictionary
00:53:18
the key is City and of course if you want you
00:53:21
can assign a default value
00:53:23
for this key for example new york And
00:53:26
now I will get new york here on this
00:53:28
line like this you can collect all the
00:53:30
named arguments into a dictionary
00:53:32
using two asterisks in the
00:53:34
parameter block And the name of the variable, of course,
00:53:37
can be different, not necessarily. For
00:53:39
example, you can change arox here to
00:53:42
Person and change it in other places and
00:53:44
also after running the code I will see the
00:53:47
same result So that's all for
00:53:50
arguments with keywords in Python
00:53:53
[music] it is a
00:53:57
sign of good form to
00:53:59
add a description to every function
00:54:02
you declare in python and this is
00:54:04
done as follows Let's
00:54:06
declare a function called self with two
00:54:08
parameters a/b and here the kilo
00:54:11
function description is added to the beginning of the
00:54:13
function body using 3 double
00:54:16
or single quotes so Let's
00:54:19
Add them and here between them we will add a
00:54:22
description of this function sums two
00:54:25
numbers So let's return A + B and
00:54:30
now if below I call this function I
00:54:34
will see the description here in this popup
00:54:37
window sums two numbers And now I can
00:54:40
call this function with two arguments
00:54:42
let's say 2 and 5 and as a result I will get 7 and
00:54:46
if you want you can output this
00:54:49
result to the terminal like this, run
00:54:51
the application and I see 7 in the output like this
00:54:54
the description of the function is added also If
00:54:57
you want you can split it into
00:54:59
several lines like this so summing two
00:55:01
numbers the numbers must be integers,
00:55:05
we launch the application after this and I
00:55:08
see the same result and now if I
00:55:11
hover the mouse over myself I will see a changed
00:55:14
description summing two numbers the numbers must
00:55:16
be integers this is a multi-line description
00:55:19
of the function So that's all about the
00:55:21
Python function
00:55:23
[music ]
00:55:27
Let's now talk about
00:55:29
comparison operators in python equal not equal more
00:55:34
less more or equal and less than or
00:55:38
equal and the expression with all these
00:55:40
operators are converted to boolean
00:55:43
value True Or false let's declare
00:55:45
two variables and integer 10 and bir
00:55:49
integer 12 and Let's output
00:55:52
terminal comparison sign B let's execute the code and
00:55:56
we will get false because this
00:55:58
expression returned the boolean value
00:56:00
false because Hey is not equal to b if I
00:56:04
change B to 10 then I will get the boolean
00:56:07
value True But what if there is a string
00:56:10
let's say 10 like this let's see
00:56:12
what we get we will get false
00:56:15
because now these variables have different
00:56:17
types, here is an integer intenger and here is
00:56:21
a string and in this case such an expression with the
00:56:23
comparison operator will return false
00:56:25
Okay, let's go back to the number 5 for
00:56:28
example and Let's duplicate this
00:56:31
line several times here it will not be
00:56:34
equal here it will be greater here will be
00:56:38
less next will be greater than or equal to and at the
00:56:42
end will be less than or equal to Let's
00:56:44
run the code and I'll get the following
00:56:47
results which are pretty obvious
00:56:49
this is actually basic math
00:56:51
if these values ​​are the same
00:56:54
Let's change the value of variable A to
00:56:57
5 and run the code I got True on this
00:57:00
line A is equal to B And I will also get on
00:57:04
these lines Hey greater than or equal to B and
00:57:07
less than or equal to B This is
00:57:10
how comparison operators work and
00:57:13
again an expression with such
00:57:16
operators always returns a Boolean
00:57:18
value either True or false
00:57:21
[music]
00:57:25
now let's talk about logical operators
00:57:27
in python such as and or and not an
00:57:32
expression with logical operators or
00:57:35
return a specific value
00:57:39
an expression with an operator does not return
00:57:42
True Or false let's First look
00:57:46
at the operator and Let's declare two
00:57:49
variables with the value ABC and B
00:57:52
with the value 5 and here Let's print the
00:57:55
result of such an expression like Hey and
00:58:01
Let's see what we get and I
00:58:04
see 5 and that's actually the value of the
00:58:07
second operand in this expression with the
00:58:10
operator and
00:58:11
if I change Hey to an empty string This is
00:58:15
how I get an empty string as the result of
00:58:17
this expression Why Because the
00:58:21
and operator always returns the first
00:58:24
value is false and the value of A is
00:58:27
false it is an empty string Or for example
00:58:30
if it is 0 it is also a false
00:58:33
value we discussed false value
00:58:35
earlier I will get 0 after running this
00:58:38
code But usually operators like and or
00:58:41
and are not used in conditional statements
00:58:44
and we will talk about them a little later and the
00:58:47
result of such an expression will be
00:58:48
true if both operands this and this are
00:58:52
true But if at least one of the operands
00:58:56
this or this is false then the result of
00:59:00
such an expression will be false Let's
00:59:03
print in the terminal
00:59:05
the result of the conversion to a Boolean
00:59:07
value expression a and b Let's
00:59:10
execute code And now I see false
00:59:14
Because one of these values ​​is false
00:59:17
This is if I change Hey to the number 10 and
00:59:22
run the code I will get True because
00:59:25
now this expression is true both values ​​are
00:59:28
true
00:59:30
If by is let's say false let's say
00:59:33
NAN the result will be false because
00:59:37
NAN is also a false value. If it
00:59:41
is NAN and bi is, say, the number 5,
00:59:44
the result will be the same because it does not
00:59:47
matter which of the operands is false,
00:59:50
either this one or this one, in both cases we
00:59:54
will get here in this line false
00:59:57
[music]
01:00:01
also if I add here another
01:00:04
variable for example si its value will be the
01:00:06
string A and here I will add it to this
01:00:09
expression and C and Let's add it
01:00:13
here too and that's it and run the code I will get exactly the
01:00:17
same result as before here in
01:00:19
this line I will get Nan this is the value of
01:00:21
the first operand and here in this
01:00:24
expression And in this line I will get false
01:00:28
and this means that it doesn't really
01:00:30
matter what values ​​the BBC has
01:00:33
here in this expression because Python
01:00:36
sees that the value is false
01:00:39
so there is no need to evaluate all the
01:00:41
following expressions here and here
01:00:44
Because here we see actually an
01:00:46
expression and python stops here
01:00:48
in this example after evaluating the first
01:00:51
expression because this expression is false
01:00:54
But if hey nice for example in the string ABC
01:00:59
then python will continue evaluating the other
01:01:02
operands And now I get A is the
01:01:05
value of the last variable C because
01:01:08
that the value of A is true so we move on
01:01:11
to the next expression the value of B is also
01:01:15
true so we continue and finally
01:01:18
we evaluate the last expression it is
01:01:21
also true and therefore its value
01:01:23
is returned as a result of the entire
01:01:25
expression with two operators and the
01:01:27
result is ultimately true if
01:01:30
it is converted to a boolean value But
01:01:33
if by is false for example 0 then C
01:01:36
will not be evaluated and python will stop
01:01:39
here after evaluating the expression B and this
01:01:44
is called short circuit evaluation
01:01:46
does not matter what happens next if
01:01:49
we have already found the first false value in
01:01:51
such an expression
01:01:52
it is immediately returned as the
01:01:55
result of the entire expression the remaining
01:01:58
part is not processed For example, I can
01:02:01
replace C here with a function call Print
01:02:04
not Cold like this, let's execute this
01:02:07
code and I don't see that the Print function is
01:02:10
called because the
01:02:12
evaluation did not reach this expression, this function call
01:02:16
is actually an expression here But
01:02:20
if we change the value of bin to true
01:02:22
value for example 2 then I will see in
01:02:24
the terminal not Cold because now this
01:02:27
expression has been evaluated the
01:02:29
function print function actually
01:02:31
returns NAN So here on this
01:02:33
line we get NAN as a result of
01:02:35
this whole expression But in this line
01:02:38
we still see True Because
01:02:41
here I haven't changed C to Print esi is
01:02:44
still true so this whole
01:02:46
expression is true this
01:02:48
is called short circuit evaluation in
01:02:51
python
01:02:52
[music]
01:02:56
ok Let's move on And now let's talk about the
01:02:59
or operator Let's remove and from here
01:03:02
like this and Let's remove and also from here
01:03:05
and Let's replace here and with or and
01:03:10
let's get rid of the variable C like
01:03:13
this let's now run the code and I
01:03:16
get ABC as the result of the expression or
01:03:20
B and this expression is true
01:03:23
so here I get True And as you
01:03:26
can see the result of the whole expression
01:03:28
is the first true value
01:03:32
i.e. the value of this expression if I
01:03:35
change the value and for example to an empty
01:03:38
string this is a false value then in the end we
01:03:41
will get 2 this is the value of B but still
01:03:44
this whole expression or true it will be
01:03:47
false only in one case if both
01:03:51
operands are false
01:03:53
for example A is an empty string AB NAN Let's
01:03:58
see what we get now I see for
01:04:00
us this value of the last operand B in
01:04:03
this expression and of course this
01:04:06
value is false so here I get
01:04:09
false and this proves that such an
01:04:11
expression will be converted to false
01:04:14
only if both operands are
01:04:17
false You can of course add more
01:04:20
one operator or here for example or c
01:04:23
and Here we will also add or c and Let's
01:04:27
declare a variable c and assign a
01:04:30
number to it for example 10 Let's execute the code And
01:04:33
now I get a true value
01:04:35
because one of the operands is
01:04:37
true it is strength and its value is
01:04:40
returned as the result of the entire
01:04:42
expression The rule here is the same as
01:04:44
before, the result of the entire expression
01:04:46
is the first true value. But
01:04:49
if it is also false, for example 0, I
01:04:52
will get A
01:04:56
or B or SIM as a result of the entire expression, and of course such a
01:04:58
value is false, so here I
01:05:02
get a fold as a result of transforming
01:05:03
this expression to boolean But as
01:05:06
soon as python finds the first true
01:05:09
value for example the string ABC Let's
01:05:12
run the code it will be returned as the
01:05:15
result of the entire expression and python
01:05:17
stops and does not evaluate all the
01:05:20
remaining expressions Now this is the
01:05:22
operator or is also the
01:05:25
short circuit operator
01:05:26
[music]
01:05:31
Now let's look at the operator not
01:05:33
which returns either True Or false
01:05:36
let's declare only one variable A
01:05:39
and Let's assign a string to it Like this and
01:05:42
Let's print the terminal not A Let's
01:05:44
see what we get we see false
01:05:47
Because now the value of A is true not A
01:05:51
is false But if A is an empty
01:05:54
string I of course will get True because
01:05:57
now the value of L is false and the negation of a
01:06:00
false value gives True you can
01:06:04
use the operator more than twice like this
01:06:06
not not in this example I get false
01:06:10
because Hey now the
01:06:12
value is false this expression is equivalent to
01:06:15
this
01:06:16
function call in both cases I get
01:06:19
false If you want to check
01:06:22
whether a particular value is false or not,
01:06:24
it is better to use such a conversion
01:06:26
to a Boolean value rather than a double
01:06:28
negation
01:06:29
[music]
01:06:33
Of course you can combine
01:06:35
various Boolean and
01:06:37
comparison operators for example an
01:06:39
expression such as 5 and the string ABC and not the number
01:06:44
3 is valid expression in python
01:06:47
Let's look at the result of such an
01:06:50
expression and the result is false but
01:06:52
please be careful When you
01:06:54
combine operators and Or for example
01:06:57
if there is an operator here or I will end
01:07:00
up with 5 But if I put this part of the
01:07:04
expression in parentheses and here it will be
01:07:07
Here is the opening parenthesis here closing
01:07:10
parenthesis I will get a different result I
01:07:13
got false because now with these
01:07:15
parentheses this expression must be
01:07:17
true and this must be true but
01:07:21
if I remove the parentheses and go back to the
01:07:23
previous option This is how this
01:07:25
value will be returned as the result of the
01:07:27
entire expression because python
01:07:30
processes operands one by one and
01:07:33
here we find the first truthful
01:07:35
value before the or operator and so
01:07:38
it is returned as a result of
01:07:40
this entire expression So if you want to
01:07:43
combine or operators Use
01:07:45
parentheses to influence the order in which
01:07:48
python interprets expressions So that's
01:07:52
all about logical operators in
01:07:54
python
01:07:55
[music ]
01:07:59
conditional and logical operators are most
01:08:02
often used in conditional
01:08:04
statements and now let's talk about
01:08:07
them the syntax consists of
01:08:10
keywords like If lif and LS let's start
01:08:14
with just the keyword If Let's
01:08:17
declare a new variable and call it
01:08:19
name Let's assign a value to it
01:08:21
for example Bogdan and there will be conditions here If
01:08:25
name Let's perform some action
01:08:27
Let's print into the terminal let's execute
01:08:30
the code and I see Bogdan here in the terminal
01:08:33
Because now this condition is true This
01:08:38
means that in a conditional If statement
01:08:40
this block of code is executed only if
01:08:42
the condition is true You can Add
01:08:45
several here other lines of code how this
01:08:47
is done in functions for example You can
01:08:49
print the name twice this is a completely
01:08:51
valid block of code inside a statement
01:08:55
But if this condition is false For example if
01:08:58
the name is an empty string then this block of
01:09:01
code will not be executed
01:09:04
and if you want to execute another block of
01:09:06
codes in case it the condition is false You
01:09:09
can use the els block like this
01:09:12
and here Let's print in
01:09:15
the terminal the line name is empty name is
01:09:18
empty Let's run the code and I see
01:09:21
one output You
01:09:23
can also add a blog
01:09:26
in this statement with If Let's go back
01:09:30
to the Bogdan value and also Let's
01:09:32
add the last name I'll indicate your last name
01:09:35
here in this way and now Let's
01:09:38
do the following if name then
01:09:41
print name after that If we add
01:09:44
another PM and blog abbreviated as lif and there
01:09:49
will be one more condition
01:09:51
and Let's print like this and in the
01:09:56
EOS block instead of name is ampty we write name
01:09:59
and
01:10:02
Let's run code And now I see
01:10:05
Bogdan because name is true. If there
01:10:08
is an empty line or NAN here I
01:10:11
should see the last name and Yes, here it is
01:10:14
output if the value by comparison is also
01:10:16
false for example an empty string we will see
01:10:19
name and
01:10:21
But what if I want to add another
01:10:24
condition and output and first and last name if
01:10:28
both values ​​are not false Let's go back
01:10:31
to the real values ​​here and Let's
01:10:34
think about where we should add
01:10:37
another condition Let's try Add
01:10:40
it here
01:10:42
Let's print the first and last name into the
01:10:46
terminal like this Let's
01:10:49
now run the code and I see Bogdan
01:10:51
because that they stop here
01:10:55
if this condition is true
01:10:59
python does not go to other
01:11:01
lif instructions here here and here so more
01:11:06
specific conditions for example this in
01:11:09
our example we should place above
01:11:11
before the less specific conditions like
01:11:14
this and this Let's cut this from here and
01:11:18
paste it here into the beginning of this conditional
01:11:21
statement If and of course you need
01:11:23
to change Live to If here and them to L
01:11:28
And here Let's now run this
01:11:31
code And now I get the first and last name but
01:11:36
if the name is false This is how I get
01:11:39
only the last name here this is
01:11:42
how conditionals work instructions in
01:11:44
Python, only one block of code is executed,
01:11:47
either this or this or this or the
01:11:50
last If all the previous Conditions
01:11:53
were false, like for example now
01:11:56
And in fact, inside Python
01:11:59
converts each expression into a
01:12:01
logical value This means that
01:12:04
such a condition and conditions Bull calling the
01:12:07
function name and equals True are identical But
01:12:12
you don't have to do this
01:12:14
conversion yourself, python
01:12:16
does it for you so you
01:12:19
only need to specify the specific expression in the
01:12:21
condition and don't worry about
01:12:23
converting it to a boolean
01:12:25
So that's it for instructions in
01:12:28
python
01:12:30
[music]
01:12:33
now let's talk about formatting strings
01:12:36
in Python string formatting is required
01:12:38
When, for example, you want to create a string
01:12:41
and insert into it the value of some
01:12:43
variables or integer expressions, let's say
01:12:46
that there is a variable name value Bogdan
01:12:49
and also from a variable say drink and its
01:12:51
value T and I want to create a new string
01:12:54
Bogdan likes to drink tea and I can
01:12:58
do this as follows print
01:13:00
Print then call the function name operator
01:13:03
plus a string in it Space then like
01:13:08
another space again operator plus like this
01:13:12
let's execute this code and I see
01:13:14
the line Bogdan like
01:13:16
but this approach is inconvenient to
01:13:19
use in Python there is a
01:13:21
string interpolation function and you can instead of
01:13:25
this entire expression, write the following F,
01:13:28
then there are double quotes or
01:13:31
single quotes, here there will be a name in
01:13:34
curly braces, then we just continue to
01:13:37
write the line like to drink That's it, and
01:13:41
here there will be another expression in curly
01:13:44
braces drink Let's now run
01:13:46
the code and I get exactly the same the result is
01:13:49
called string interpolation and
01:13:52
Python interprets such an expression
01:13:55
during program execution when it
01:13:57
can determine the value of these
01:13:59
expressions because here you can
01:14:01
use any expression for example
01:14:04
name uper function call and we see the name
01:14:07
Bogdan in upper case between these
01:14:10
curly braces You can put
01:14:12
any expression, even a function call If
01:14:15
you want, this function has become available in
01:14:17
Python since version 3.6
01:14:21
and there are other available ways to
01:14:23
format strings, but this is the
01:14:25
simplest. In my opinion, and therefore I
01:14:29
will not show you older and,
01:14:31
frankly speaking, more complex approaches to
01:14:34
formatting strings like this way you
01:14:36
can format strings very easily
01:14:38
in python
01:14:39
[music]
01:14:43
Let's now talk about errors in
01:14:46
python programs and for example Let's
01:14:48
write 10 and divide it by 0 Let's
01:14:51
execute this code and I see a
01:14:53
divide by zero error and if you try to
01:14:56
do some other things
01:14:59
after this lines of code for example Let's
01:15:02
say we display the terminal Continuous
01:15:05
Let's run this code then we won't
01:15:08
see continue here in the output Because
01:15:11
in fact the program was interrupted on
01:15:14
this line where we were performing division
01:15:17
by zero an error occurred and here are the details of
01:15:20
such an error Therefore if you want to
01:15:23
go to this example to this line and
01:15:25
call the Print function you need to wrap
01:15:27
this line of code in a Type except block
01:15:31
using the following syntax here
01:15:34
Select from the dropdown menu this option and
01:15:37
After selecting you will see that viscode will
01:15:40
automatically add the Strike code template
01:15:43
and here Let's move this line into a
01:15:46
block like this Which earlier Let's
01:15:49
divide 10 by 0 And here in the Set sections
01:15:52
Let's just leave the groove I remind you that
01:15:56
pass is a special instruction
01:15:57
that does nothing is used
01:16:00
where Python expects a block of code from you
01:16:04
Let's run this code now and I
01:16:06
will see continue here in the output, this means
01:16:10
that this is an error which occurred here on
01:16:12
this line did not go beyond the scope of this
01:16:15
block and, if necessary, you can
01:16:17
process this error in a certain way
01:16:20
that occurred here in this
01:16:22
block Troy Let's look again at the
01:16:25
type of error, move this line back,
01:16:27
execute the code and the error was division by 0,
01:16:31
make a move era We can take this
01:16:34
type of error from here and put it in the
01:16:36
except except Zero division block
01:16:40
and here there will be a variable and Let's
01:16:43
display the terminal And like this and Let's
01:16:47
of course get rid of the line pass it is
01:16:49
no longer needed Let's execute the code I
01:16:52
see just a line
01:16:53
this is the value of the variable and here inside
01:16:56
the except block and this is what we get
01:16:59
when we use a specific type of
01:17:01
error Zero Division
01:17:04
and the execution of the code continued So
01:17:06
here on this line I see continue in the
01:17:09
terminal like this you can handle
01:17:11
different types of exceptions using Try
01:17:14
except Block in python
01:17:17
[music]
01:17:22
latest topic in this course these are
01:17:25
python modules and with the help of modules in python you
01:17:27
can divide your application into
01:17:30
different files and create different parts of
01:17:32
your code in different files and essentially
01:17:36
every file in your project that
01:17:38
has a dot UI extension is a
01:17:41
python module and now the application has
01:17:44
only one module called main.ua
01:17:46
there are system modules that you can
01:17:49
use in your modules for example
01:17:52
there is a module called there
01:17:53
are also external modules that you
01:17:56
can install if you need to
01:17:58
use them let's start with
01:18:00
using built-in modules in
01:18:02
python and if you want to import
01:18:04
some variables from another module
01:18:06
you need to use the
01:18:08
import keyword You can import only
01:18:11
specific variables from another
01:18:12
module or you can import the
01:18:14
entire module for example Let's We
01:18:17
lock the entire module with the name it is
01:18:19
built in python and Here you can
01:18:21
read that this mess module
01:18:23
provides access to different
01:18:25
mathematical functions Let's
01:18:27
import the entire module and now here in the
01:18:30
main.ua file we can access any
01:18:33
variables defined in this
01:18:35
mathematical module. If you write and
01:18:39
put a dot, then after the dot you
01:18:41
will see all the possible variables that are
01:18:43
present in this module and you can
01:18:46
use any of these variables
01:18:48
inside the main.ua file in your actual
01:18:51
module For example, you have access to a
01:18:54
variable called pi this is
01:18:56
actually the constant pi If you print it
01:18:59
into the terminal you will see the number pi here
01:19:02
it is in the same way you can
01:19:05
access any variables
01:19:08
you define in the math module Let's now
01:19:10
create our own module Let's
01:19:13
remove this from here and Let's create a
01:19:16
new file in our project and call it
01:19:18
on Mad Mobil the name here can be anything
01:19:22
Whatever you want and add the
01:19:25
dot UI extension in this our own module
01:19:28
Let's define a function with the name itself with
01:19:31
two parameters A and B and here Let's
01:19:35
add a description for this function
01:19:37
for example the Numbers chair itself in a similar
01:19:41
way as we did earlier Let's
01:19:42
return the plus B That's it, that's all you
01:19:47
need to do here in this file And
01:19:50
now we can very easily
01:19:51
import this function itself from its
01:19:54
own module into the main.ua module
01:19:57
using the same import keyword.
01:20:01
Note that the weight code suggests
01:20:03
to me the name of this module because now
01:20:06
it knows about the presence of such a module in our
01:20:10
python application because Let's click
01:20:13
Temp to automatically complete the name of
01:20:15
this module and now here I can
01:20:17
access any variables
01:20:19
defined in this module Let's
01:20:22
call the function itself declared in this
01:20:24
module it Maps modial point itself here you
01:20:28
see this option in the list and Let's
01:20:30
call this function with two arguments
01:20:33
also Here you see the names of the two
01:20:36
parameters
01:20:37
and description of the function itself that's the summary So
01:20:40
5,6 and also Let's output the result to the
01:20:43
terminal like this let's run the code I
01:20:46
see 11
01:20:48
here's how it's very easy using the
01:20:50
import keyword You can use
01:20:52
the functionality created in other
01:20:55
Python modules If you want you can also
01:20:58
import only specific
01:21:00
variables using the following syntax
01:21:02
From on Med Model import itself and now on
01:21:07
this line we don't need to call it
01:21:10
matmobil but just need to call the function
01:21:13
itself Let's execute the code and the result
01:21:15
will be the same this means that if you
01:21:18
want to selectively import
01:21:19
only some variables from module You
01:21:22
can use this syntax From
01:21:24
module name import and then come the names of the
01:21:28
variables that you want to
01:21:30
import If you want to
01:21:32
import the entire module You can
01:21:34
simply use the
01:21:35
import keyword That's all about modules in
01:21:38
python and that's the end of this course on python
01:21:40
As you have seen python relatively
01:21:43
simple language and it is very close to the
01:21:45
human language There are words like
01:21:48
about notes and there are not a lot of
01:21:50
special characters Now you know the
01:21:53
basics of the Python language And I wish you good luck
01:21:55
in further learning Python Don't forget to
01:21:58
like this video write
01:22:00
a comment and also share this
01:22:02
social media videos see you in the
01:22:04
next videos

Description:

🔵 Полный курс Python [43 ЧАСА] https://www.udemy.com/course/python-ru/?couponCode=PYTHONRUAPR2024 🟠 Полный курс Python (English) [50 ЧАСОВ] https://www.udemy.com/course/python-complete-guide/?couponCode=PYTHONENAPR2024 🔥 Полный курс JavaScript [24 ЧАСА] https://www.udemy.com/course/javascript-ru/?couponCode=JSRUAPR2024 🍺 🍺 Донаты и благодарности https://buymeacoffee.com/bstashchuk ⭐️ Все мои курсы https://stashchuk.com/ 🎦 Подпишись на канал YouTube https://www.youtube.com/CodingTutorials?sub_confirmation=1 🙍 LinkedIn https://www.linkedin.com/in/bogdanstashchuk/ 📪 Twitter https://twitter.com/BogdanStashchuk 🔥 Профиль Udemy https://www.udemy.com/user/bogdanstashchuk/ Написать мне 📧 [email protected] 00:00:00 Обзор ускоренного курса Python 00:01:41 Привет от Питона 00:02:58 Базовые типы 00:04:17 Преобразование между типами 00:05:15 Ложные значения 00:06:04 Выбор названий для переменных и констант 00:07:08 Переменные и динамическая типизация 00:08:26 Базовые типы копируются по значению 00:09:28 Увеличение и уменьшение переменных 00:10:46 Списки 00:13:59 Tuples 00:15:50 Словари 00:22:07 Копирование по ссылке 00:24:38 Наборы 00:27:13 Итоги по типам контейнеров 00:30:09 Установка и настройка Code Runner в VS Code 00:36:26 Функции 00:41:45 Позиционные аргументы 00:44:00 Именованные аргументы 00:45:23 Сбор всех аргументов в tuple 00:47:20 Перебор значений с использованием цикла for...in 00:49:29 Использование kwargs в функциях 00:53:54 Описание функций 00:55:24 Операторы сравнения 00:57:22 Логический оператор and 00:59:58 Оценка короткого замыкания 01:02:53 Логический оператор or 01:05:27 Логический оператор not 01:06:30 Комбинация операторов и приоритет 01:07:56 Условные инструкции if 01:12:30 Форматирование строк 01:14:40 Обработка ошибок с использованием try…except 01:17:18 Модули Python

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 - Курс Python Для Начинающих [1.5 ЧАСА]" 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 - Курс Python Для Начинающих [1.5 ЧАСА]" 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 - Курс Python Для Начинающих [1.5 ЧАСА]" 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 - Курс Python Для Начинающих [1.5 ЧАСА]" 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 - Курс Python Для Начинающих [1.5 ЧАСА]"?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 - Курс Python Для Начинающих [1.5 ЧАСА]"?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.