Добавить less2.md

This commit is contained in:
parent f6d48382a4
commit a581f08c6c
1 changed files with 36 additions and 0 deletions

36
less2.md Normal file
View File

@ -0,0 +1,36 @@
Ссылка на урок: https://youtu.be/XnWORRJVDfw?si=jsBtVj0EW-UPk3qM
List (Списки, похожи на массивы в 1С)
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)
Tuple, кортеж, не изменяемый список
price = (75, 80, 15, 41)
del price[0]
Dict (словарь, ассоциативный список, похож на соответствие в 1С)
products = {}
products["стул"] = 100
products["стол"] = 200
print(products)
Set, множества - "контейнер", содержащий не повторяющиеся элементы
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)
print(price_4)