Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

multiple variables in for loop python

>>> for i, j in [(0, 1), ('a', 'b')]:
...     print('i:', i, 'j:', j)
...     
i: 0 j: 1
i: a j: b
Comment

multiple variables in for loop python

for i, j in zip(range(x), range(y)):
    # Stuff...
Comment

how to create multiple variables in a loop python

# i gets added to the end of the var name
i = 1
for n in range(5):
    globals()["w" + str(i)] = ###Do what you want here
    i += 1
Comment

PREVIOUS NEXT
Code Example
Python :: python docstring use 
Python :: games made with python 
Python :: how to sort nested list in python 
Python :: python check if character in string 
Python :: join tables pandas 
Python :: false python 
Python :: np.vstack python 
Python :: string functions 
Python :: convert int to hexadecimal 
Python :: slider python 
Python :: hash password python 
Python :: how to get data from django session 
Python :: pandas split groupby 
Python :: why is python so popular 
Python :: how to run a python package from command line 
Python :: python if loop 
Python :: reading an image using opencv library 
Python :: python 3.9 release date 
Python :: python newton raphson 
Python :: how to make a calcukatir in python 
Python :: find max value in 2d array python 
Python :: run flask in background 
Python :: python sum of 10 numbers from user input 
Python :: add in python 
Python :: how to add two strings in python 
Python :: sklearn euclidean distance 
Python :: how to create a variable that represents any integer in python 
Python :: python global keyword 
Python :: Mixed Fractions in python 
Python :: stackoverflow - import data on colabs 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =