|
|
|
@ -437,6 +437,31 @@ False
|
|
|
|
4.0
|
|
|
|
4.0
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 7.5. Множественное присваивание
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
>>> n1,n2,v3=(11,-3,'all');n1;n2;n3
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
-3
|
|
|
|
|
|
|
|
'all'
|
|
|
|
|
|
|
|
>>> n1,n2,n3="11","-3","all";n1;n2;n3
|
|
|
|
|
|
|
|
'11'
|
|
|
|
|
|
|
|
'-3'
|
|
|
|
|
|
|
|
'all'
|
|
|
|
|
|
|
|
>>> n1,n2,n3=[11,-3,'all'];n1;n2;n3
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
-3
|
|
|
|
|
|
|
|
'all'
|
|
|
|
|
|
|
|
>>> n1,n2,n3={11:1,-3:2,'all':3};n1;n2;n3
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
-3
|
|
|
|
|
|
|
|
'all'
|
|
|
|
|
|
|
|
>>> n1,n2,n3={11,-3,'all',-3,11};n1;n2;n3
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
'all'
|
|
|
|
|
|
|
|
-3
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 8. Логические операции
|
|
|
|
## 8. Логические операции
|
|
|
|
|
|
|
|
|
|
|
|
### 8.1. Сравнение
|
|
|
|
### 8.1. Сравнение
|
|
|
|
@ -569,6 +594,8 @@ False
|
|
|
|
```py
|
|
|
|
```py
|
|
|
|
>>> spsk=[123,'lala',False,'abc','12'];spsk
|
|
|
|
>>> spsk=[123,'lala',False,'abc','12'];spsk
|
|
|
|
[123, 'lala', False, 'abc', '12']
|
|
|
|
[123, 'lala', False, 'abc', '12']
|
|
|
|
|
|
|
|
>>> dir(spsk)
|
|
|
|
|
|
|
|
['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
|
|
|
|
>>> spsk.pop(2);spsk
|
|
|
|
>>> spsk.pop(2);spsk
|
|
|
|
False
|
|
|
|
False
|
|
|
|
[123, 'lala', 'abc', '12']
|
|
|
|
[123, 'lala', 'abc', '12']
|
|
|
|
@ -586,6 +613,8 @@ False
|
|
|
|
```py
|
|
|
|
```py
|
|
|
|
>>> k=(3+3j,'oo',1,'324','hello');k
|
|
|
|
>>> k=(3+3j,'oo',1,'324','hello');k
|
|
|
|
((3+3j), 'oo', 1, '324', 'hello')
|
|
|
|
((3+3j), 'oo', 1, '324', 'hello')
|
|
|
|
|
|
|
|
>>> dir(k)
|
|
|
|
|
|
|
|
['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
|
|
|
|
>>> k.count(3)
|
|
|
|
>>> k.count(3)
|
|
|
|
0
|
|
|
|
0
|
|
|
|
>>> k.count(1)
|
|
|
|
>>> k.count(1)
|
|
|
|
@ -605,6 +634,8 @@ False
|
|
|
|
```py
|
|
|
|
```py
|
|
|
|
>>> sl={'a':1,'b':2,'c':3,'d':4,'e':5};sl
|
|
|
|
>>> sl={'a':1,'b':2,'c':3,'d':4,'e':5};sl
|
|
|
|
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
|
|
|
|
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
|
|
|
|
|
|
|
|
>>> dir(sl)
|
|
|
|
|
|
|
|
['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
|
|
|
|
>>> sl.keys()
|
|
|
|
>>> sl.keys()
|
|
|
|
dict_keys(['a', 'b', 'c', 'd', 'e'])
|
|
|
|
dict_keys(['a', 'b', 'c', 'd', 'e'])
|
|
|
|
>>> sl.values()
|
|
|
|
>>> sl.values()
|
|
|
|
@ -623,6 +654,8 @@ dict_values([1, 2, 3, 4, 5])
|
|
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
```py
|
|
|
|
>>> mn={1,11,'lo',11,'mnoz','123','mnoz'};mn
|
|
|
|
>>> mn={1,11,'lo',11,'mnoz','123','mnoz'};mn
|
|
|
|
|
|
|
|
>>> dir(mn)
|
|
|
|
|
|
|
|
['__and__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']
|
|
|
|
{'123', 1, 'mnoz', 11, 'lo'}
|
|
|
|
{'123', 1, 'mnoz', 11, 'lo'}
|
|
|
|
>>> mn.add(2);mn
|
|
|
|
>>> mn.add(2);mn
|
|
|
|
{'123', 1, 2, 'mnoz', 11, 'lo'}
|
|
|
|
{'123', 1, 2, 'mnoz', 11, 'lo'}
|
|
|
|
|