Telegram Group & Telegram Channel
Создаем бесконечный итератор

Функция cycle() из itertools принимает на вход итерируемый объект и создает бесконечный итератор, циклически возвращающий элементы данного объекта.

Фишка заключается в том, что когда элементы последовательности заканчиваются, итерация начинается вновь с первого элемента.

Но если вы проходитесь циклом по такому итератору, то важно предусмотреть выход из цикла, иначе он станет бесконечным (как у нас в первом случае на картинке).

Мы также можем воспользоваться islice(), который вернет итератор по подмножеству переданного объекта.

#itertools



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

Создаем бесконечный итератор

Функция cycle() из itertools принимает на вход итерируемый объект и создает бесконечный итератор, циклически возвращающий элементы данного объекта.

Фишка заключается в том, что когда элементы последовательности заканчиваются, итерация начинается вновь с первого элемента.

Но если вы проходитесь циклом по такому итератору, то важно предусмотреть выход из цикла, иначе он станет бесконечным (как у нас в первом случае на картинке).

Мы также можем воспользоваться islice(), который вернет итератор по подмножеству переданного объекта.

#itertools

BY Python Academy




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

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Look for Channels Online

You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

Python Academy from id


Telegram Python Academy
FROM USA