Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

create new list in for loop python

#If you are trying to make a NEW list in a for loop do this:


EXAMPLE:
new_list = [i for i in range(number)]
print(new_list)

#OUTPUT: [val1, val2, val3, val4... valn]
 
PREVIOUS NEXT
Tagged: #create #list #loop #python
ADD COMMENT
Topic
Name
5+3 =