Looping over two lists at once in Python

preview_player
Показать описание
Need to loop over two (or more) iterables at the same time? Don't use range. Don't use enumerate. Use the built-in zip function. As you loop over zip you'll get the n-th item from each iterable.

00:00 Looping over just one iterable
00:23 Using nested loops
00:58 Indexing with enumerate
01:40 Using the built-in zip function
02:30 Use Python's zip function to loop over multiple iterables at once
Рекомендации по теме