/
Pac_Lord
/
homework_iterators_generators
Обзор
Документация
Войти
/
Pac_Lord
/
homework_iterators_generators
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
task_2.py
29 строк
706 B
Pac_Lord
initial commit
16 май 2026, 08:09
16 май 2026, 08:09
6668d4d
Код
Авторство
О чём код?
import types def flat_generator(list_of_lists): for sublist in list_of_lists: for item in sublist: yield item def test_2(): list_of_lists_1 = [ ['a', 'b', 'c'], ['d', 'e', 'f', 'h', False], [1, 2, None] ] for flat_iterator_item, check_item in zip( flat_generator(list_of_lists_1), ['a', 'b', 'c', 'd', 'e', 'f', 'h', False, 1, 2, None] ): assert flat_iterator_item == check_item assert list(flat_generator(list_of_lists_1)) == ['a', 'b', 'c', 'd', 'e', 'f', 'h', False, 1, 2, None] assert isinstance(flat_generator(list_of_lists_1), types.GeneratorType) if __name__ == '__main__': test_2()