|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
# Отчет по теме 3. Капитонов Михаил А-02-23
|
|
|
|
|
Отчет по теме 3. Капитонов Михаил А-02-23
|
|
|
|
|
|
|
|
|
|
## 1. Запустил оболочку IDLE и настроил рабочий каталог
|
|
|
|
|
|
|
|
|
@ -847,26 +847,47 @@ spsk.count('a')
|
|
|
|
|
### 9.3. Самостоятельно изучил методы кортежа
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
krt = (1,2,3,4,5)
|
|
|
|
|
dir(krt)
|
|
|
|
|
|
|
|
|
|
t = (3, 3, 5, 6, 7)
|
|
|
|
|
dir(t)
|
|
|
|
|
['__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']
|
|
|
|
|
krt.count(5)
|
|
|
|
|
|
|
|
|
|
1
|
|
|
|
|
t.count(3)
|
|
|
|
|
2
|
|
|
|
|
t.index(7)
|
|
|
|
|
4
|
|
|
|
|
len(t)
|
|
|
|
|
5
|
|
|
|
|
t[1]
|
|
|
|
|
3
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 9.4. Самостоятельно изучил методы словарей
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
dirr={"A":3, "B":4}
|
|
|
|
|
|
|
|
|
|
dir(dirr)
|
|
|
|
|
|
|
|
|
|
#словарь
|
|
|
|
|
d = {'a': 1, 'b': 2, 'c': 3, 'd':4}
|
|
|
|
|
dir(d)
|
|
|
|
|
['__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']
|
|
|
|
|
dirr.keys()
|
|
|
|
|
|
|
|
|
|
dict_keys(['A', 'B'])
|
|
|
|
|
d.keys()
|
|
|
|
|
dict_keys(['a', 'b', 'c', 'd'])
|
|
|
|
|
d.values()
|
|
|
|
|
dict_values([1, 2, 3, 4])
|
|
|
|
|
d.get('b')
|
|
|
|
|
2
|
|
|
|
|
d.update({'t': 4})
|
|
|
|
|
d
|
|
|
|
|
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 't': 4}
|
|
|
|
|
#множество
|
|
|
|
|
s = {2, 4, 7, 1, 3}
|
|
|
|
|
dir(s)
|
|
|
|
|
['__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']
|
|
|
|
|
s.add(5)
|
|
|
|
|
s
|
|
|
|
|
{1, 2, 3, 4, 5, 7}
|
|
|
|
|
s.remove(4)
|
|
|
|
|
s
|
|
|
|
|
{1, 2, 3, 5, 7}
|
|
|
|
|
s.intersection({1, 7}) #пересечение множеств
|
|
|
|
|
{1, 7}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 10. Завершил работу в IDLE
|