Process multiple lists with for in Python

Note It seems good to use zip as below

python


a = [1, 3, 5, 7]
b = [2, 4, 6]

for (a_num, b_num) in zip(a, b):
	print(a_num, b_num)
	
#The result is as follows
# 1 2
# 3 4
# 5 6

When the processing with the shorter length is completed, it seems that the processing will end there

Recommended Posts

Process multiple lists with for in Python
Turn multiple lists with a for statement at the same time in Python
[Python] Dealing with multiple call errors in ray.init
[Introduction for beginners] Working with MySQL in Python
Settings for getting started with MongoDB in python
Multiple regression expressions in Python
Scraping with selenium in Python
Working with LibreOffice in Python
Scraping with chromedriver in python
Specific sample code for working with SQLite3 in Python
Debugging with pdb in Python
Search for strings in Python
VS Code settings for developing in Python with completion
Working with sounds in Python
Scraping with Selenium in Python
Techniques for sorting in Python
Scraping with Tor in Python
Tweet with image in Python
Combined with permutations in Python
Avoid multiple loops in Python
Prohibit multiple launches in python
About "for _ in range ():" in python
Process feedly xml with Python.
Tips for developing apps with Azure Cosmos DB in Python
Create a child account for connect with Stripe in Python
[For beginners] Summary of standard input in Python (with explanation)
A simple way to avoid multiple for loops in Python
(For myself) Flask_8 (Add / Edit / Delete in database with python)
How to define multiple variables in a python for statement
Extract multiple list duplicates in Python
Number recognition in images with Python
Check for memory leaks in Python
Testing with random numbers in Python
Check for external commands in python
Working with LibreOffice in Python: import
Scraping with Selenium in Python (Basic)
CSS parsing with cssutils in Python
Getting Started with Python for PHPer-Classes
Numer0n with items made in Python
Open UTF-8 with BOM in Python
Use rospy with virtualenv in Python3
Post multiple Twitter images with python
Animate multiple still images with Python
Use Python in pyenv with NeoVim
Heatmap with Dendrogram in Python + matplotlib
Read files in parallel with Python
Statistical test (multiple test) in Python: scikit_posthocs
Password generation in texto with python
Use OpenCV with Python 3 in Window
Multiple integrals with Python and Sympy
Run unittests in Python (for beginners)
Delete multiple elements in python list
Until dealing with python in Atom
Process Pubmed .xml data with python
Getting Started with Python for PHPer-Functions
[Python] Creating multiple windows with Tkinter
Get started with Python in Blender
Working with DICOM images in Python
Dockerfile with the necessary libraries for natural language processing in python
Handle multiple python versions in one jupyter
Write documentation in Sphinx with Python Livereload