|
|
@ -566,7 +566,7 @@ False
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
Придумайте самостоятельно еще 2-3 примера сложных логических выражений.
|
|
|
|
|
|
|
|
### 8.4.Проверка ссылок переменных на один и тот же объект (is).
|
|
|
|
### 8.4.Проверка ссылок переменных на один и тот же объект (is).
|
|
|
|
```py
|
|
|
|
```py
|
|
|
|
w=v=10 #При таком присваивании переменные ссылаются на один и тот же объект в оперативной памяти
|
|
|
|
w=v=10 #При таком присваивании переменные ссылаются на один и тот же объект в оперативной памяти
|
|
|
@ -577,18 +577,13 @@ v1=['A','B']
|
|
|
|
w1 is v1
|
|
|
|
w1 is v1
|
|
|
|
False #Они задавались отдельно друг от друга
|
|
|
|
False #Они задавались отдельно друг от друга
|
|
|
|
```
|
|
|
|
```
|
|
|
|
в оперативной памяти
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
w is v
|
|
|
|
|
|
|
|
w1=['A','B']
|
|
|
|
|
|
|
|
v1=['A','B']
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 9. Операции с объектами, выполняемые с помощью методов.
|
|
|
|
## 9. Операции с объектами, выполняемые с помощью методов.
|
|
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
```py
|
|
|
|
stroka='Микропроцессорная система управления' #получение полного списка атрибутов
|
|
|
|
stroka='Микропроцессорная система управления' #получение полного списка атрибутов
|
|
|
|
dir(stroka)
|
|
|
|
dir(stroka)
|
|
|
|
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
|
|
|
|
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
|
|
|
|
```
|
|
|
|
```
|
|
|
|
### 9.1. Методы для работы со строками.
|
|
|
|
### 9.1. Методы для работы со строками.
|
|
|
|
```py
|
|
|
|
```py
|
|
|
@ -672,14 +667,14 @@ slvr
|
|
|
|
mng={1,'a',2,'b',3,'c',4}
|
|
|
|
mng={1,'a',2,'b',3,'c',4}
|
|
|
|
mng.add('d') #добавление в множество mng элемента 'd'
|
|
|
|
mng.add('d') #добавление в множество mng элемента 'd'
|
|
|
|
mng
|
|
|
|
mng
|
|
|
|
{1, 2, 3, 4, 'b', 'd', 'a', 'c'}
|
|
|
|
{1, 2, 3, 'c', 4, 'a', 'b', 'd'}
|
|
|
|
mng.remove(3) #удаление из множества mng элемента 3
|
|
|
|
mng.remove(3) #удаление из множества mng элемента 3
|
|
|
|
mng
|
|
|
|
mng
|
|
|
|
{1, 2, 4, 'b', 'd', 'a', 'c'}
|
|
|
|
{1, 2, 'c', 4, 'a', 'b', 'd'}
|
|
|
|
mng1={5,'e',6}
|
|
|
|
mng1={5,'e',6}
|
|
|
|
mng2=mng.union(mng1) #объединение множеств mng и mng1
|
|
|
|
mng2=mng.union(mng1) #объединение множеств mng и mng1
|
|
|
|
mng2
|
|
|
|
mng2
|
|
|
|
{1, 2, 4, 5, 6, 'a', 'e', 'b', 'd', 'c'}
|
|
|
|
{1, 2, 'c', 4, 5, 6, 'a', 'b', 'e', 'd'}
|
|
|
|
mng3=mng2.intersection(mng) #пересечение множеств mng и mng2, получили mng так как mng входит в mng2
|
|
|
|
mng3=mng2.intersection(mng) #пересечение множеств mng и mng2, получили mng так как mng входит в mng2
|
|
|
|
mng3
|
|
|
|
mng3
|
|
|
|
{1, 2, 4, 'a', 'b', 'd', 'c'}
|
|
|
|
{1, 2, 4, 'a', 'b', 'd', 'c'}
|
|
|
@ -687,53 +682,4 @@ mng4=mng2.difference(mng) #разность множеств mng и mng2, пол
|
|
|
|
mng4
|
|
|
|
mng4
|
|
|
|
{'e', 5, 6}
|
|
|
|
{'e', 5, 6}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
## 10. Сохранил файл и закончил сеанс работы с IDLE.
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|