Telegram Group & Telegram Channel
3 трюка с itertools

Сегодня мы рассмотрим несколько функций из довольно полезного модуля, позволяющих эффективно работать с итерируемыми объектами. Начнём с очень простой функции – chain. Она позволяет "склеивать" несколько итерируемых элементов в один.

Далее, accumulate. Эта функция немного похожа на reduce, но вместо того, чтобы давать одно окончательное значение, она последовательно применяет функцию, заданную вторым аргументом (в данном случае min), к каждому последующему элементу по порядку: min(11), min(11, 3), min(11, 3, 9) и так далее.

А для того, чтобы создавать комбинации из элементов выбранного итерируемого объекта, вам понадобится функция combinations. Вторым аргументом можно задать длину этой самой комбинации.

#модули #itertools
1🔥1



tg-me.com/python_academy/86
Create:
Last Update:

3 трюка с itertools

Сегодня мы рассмотрим несколько функций из довольно полезного модуля, позволяющих эффективно работать с итерируемыми объектами. Начнём с очень простой функции – chain. Она позволяет "склеивать" несколько итерируемых элементов в один.

Далее, accumulate. Эта функция немного похожа на reduce, но вместо того, чтобы давать одно окончательное значение, она последовательно применяет функцию, заданную вторым аргументом (в данном случае min), к каждому последующему элементу по порядку: min(11), min(11, 3), min(11, 3, 9) и так далее.

А для того, чтобы создавать комбинации из элементов выбранного итерируемого объекта, вам понадобится функция combinations. Вторым аргументом можно задать длину этой самой комбинации.

#модули #itertools

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/86

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Telegram has exploded as a hub for cybercriminals looking to buy, sell and share stolen data and hacking tools, new research shows, as the messaging app emerges as an alternative to the dark web.An investigation by cyber intelligence group Cyberint, together with the Financial Times, found a ballooning network of hackers sharing data leaks on the popular messaging platform, sometimes in channels with tens of thousands of subscribers, lured by its ease of use and light-touch moderation.

Telegram and Signal Havens for Right-Wing Extremists

Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.

Python Academy from ca


Telegram Python Academy
FROM USA