Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

List Comprehension build a list of tuples

# build a list of tuples
li = [ (i,i*2) for i in range(1,5)]
print(li)
# [(1, 2), (2, 4), (3, 6), (4, 8)]
Source by xahlee.info #
 
PREVIOUS NEXT
Tagged: #List #Comprehension #build #list #tuples
ADD COMMENT
Topic
Name
9+6 =