PYTHON_SOLVES Telegram 43
## Генераторы списков (list comprehensions)

Тема:
Короткий способ создать список.

# Обычный способ
squares = []
for i in range(5):
squares.append(i ** 2)

# То же самое в одну строку
squares = [i ** 2 for i in range(5)]

print(squares)


Полезные советы:

* Можно добавлять условия:

even = [i for i in range(10) if i % 2 == 0]


* Удобно при парсинге данных и фильтрации.

#азы



tgoop.com/python_solves/43
Create:
Last Update:

## Генераторы списков (list comprehensions)

Тема:
Короткий способ создать список.

# Обычный способ
squares = []
for i in range(5):
squares.append(i ** 2)

# То же самое в одну строку
squares = [i ** 2 for i in range(5)]

print(squares)


Полезные советы:

* Можно добавлять условия:

even = [i for i in range(10) if i % 2 == 0]


* Удобно при парсинге данных и фильтрации.

#азы

BY Python решает 🐍


Share with your friend now:
tgoop.com/python_solves/43

View MORE
Open in Telegram


Telegram News

Date: |

How to Create a Private or Public Channel on Telegram? To delete a channel with over 1,000 subscribers, you need to contact user support The public channel had more than 109,000 subscribers, Judge Hui said. Ng had the power to remove or amend the messages in the channel, but he “allowed them to exist.” Telegram message that reads: "Bear Market Screaming Therapy Group. You are only allowed to send screaming voice notes. Everything else = BAN. Text pics, videos, stickers, gif = BAN. Anything other than screaming = BAN. You think you are smart = BAN. Your posting frequency depends on the topic of your channel. If you have a news channel, it’s OK to publish new content every day (or even every hour). For other industries, stick with 2-3 large posts a week.
from us


Telegram Python решает 🐍
FROM American