Пользователь № 10 аудитории К-522 1 неделю назад
Родитель 2e211b5a83
Сommit 385e101006

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