2024-04-24 12:07:17 +09:00
|
|
|
|
[Ссылка на урок](https://youtu.be/XnWORRJVDfw?si=jsBtVj0EW-UPk3qM)
|
2024-04-24 10:49:54 +09:00
|
|
|
|
|
2024-04-24 12:07:17 +09:00
|
|
|
|
### List (Списки, похожи на массивы в 1С) ###
|
|
|
|
|
```python
|
2024-04-24 10:49:54 +09:00
|
|
|
|
price = [75, 80, 15, 41]print(type(price), price)
|
|
|
|
|
print(price[0], price[1])
|
|
|
|
|
price.append(23)
|
|
|
|
|
print(price)
|
|
|
|
|
price.insert(0, 8)
|
|
|
|
|
print(price)
|
|
|
|
|
del price[0]print(price)
|
|
|
|
|
price.remove(15)
|
|
|
|
|
print(price)
|
|
|
|
|
print(80 in price)
|
|
|
|
|
print(max(price))
|
|
|
|
|
print(min(price))
|
|
|
|
|
|
|
|
|
|
price.append("строка")
|
|
|
|
|
print(price)
|
2024-04-24 12:07:17 +09:00
|
|
|
|
```
|
2024-04-24 10:49:54 +09:00
|
|
|
|
|
2024-04-24 12:07:17 +09:00
|
|
|
|
### Tuple, кортеж, не изменяемый список ###
|
|
|
|
|
```python
|
2024-04-24 10:49:54 +09:00
|
|
|
|
price = (75, 80, 15, 41)
|
|
|
|
|
del price[0]
|
2024-04-24 12:07:17 +09:00
|
|
|
|
```
|
2024-04-24 10:49:54 +09:00
|
|
|
|
|
2024-04-24 12:07:17 +09:00
|
|
|
|
### Dict (словарь, ассоциативный список, похож на соответствие в 1С) ###
|
|
|
|
|
```python
|
2024-04-24 10:49:54 +09:00
|
|
|
|
products = {}
|
|
|
|
|
products["стул"] = 100
|
|
|
|
|
products["стол"] = 200
|
|
|
|
|
print(products)
|
2024-04-24 12:07:17 +09:00
|
|
|
|
```
|
2024-04-24 10:49:54 +09:00
|
|
|
|
|
2024-04-24 12:07:17 +09:00
|
|
|
|
### Set, множества - "контейнер", содержащий не повторяющиеся элементы ###
|
|
|
|
|
```python
|
2024-04-24 10:49:54 +09:00
|
|
|
|
price_1 = set([75, 80, 15, 41])
|
|
|
|
|
price_2 = {80, 2, 10}
|
|
|
|
|
price_3 = price_1 | price_2
|
|
|
|
|
price_4 = price_1 & price_2
|
|
|
|
|
print(price_3)
|
2024-04-24 11:24:42 +09:00
|
|
|
|
print(price_4)
|
2024-04-24 12:07:17 +09:00
|
|
|
|
```
|
2024-04-24 11:24:42 +09:00
|
|
|
|
|
|
|
|
|
[Назад на главную](readme.md)
|