Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python list comprehension

# List comprehension example
list = [0 for i in range(10)]
# Makes a list of 10 zeros (Change 0 for different result
# and range for different length)

# Nested List
list = [[0] * 5 for i in range(10)]
# Makes a nested list of 10 list containing 5 zeros (You can also change
# all of the int to produce different results)
Source by pythonguides.com #
 
PREVIOUS NEXT
Tagged: #python #list #comprehension
ADD COMMENT
Topic
Name
8+2 =