PROGRAMMING
GAME DEVELOPMENT
zip
function to iterate two Lists together
What if you want to iterate two lists together, add their elements and save into a thrid list? Will you be using nested loops - which means loop inside a loop. For such cases, Python provides an amazing function zip
which can be used with any loop and traverse two lists together.
Try changing the code as you like. Click the button, to Run the code again.
CODE SNIPPETS
;
to join two Executable Statements/
to break code into multiline codelen()
, find()
, replace()
& split()
zip
function to iterate over two Listsdel
, remove()
or pop()
insert()
, reverse()
& sort()
What is Studytonight?
Tutorials
Learn to Code
Interview Questions
/code/python/zip-function-to-iterate-two-lists.php