Search
 
SCRIPT & CODE EXAMPLE
 

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)]
Comment

PREVIOUS NEXT
Code Example
Python :: get first not null value from column dataframe 
Python :: python popen 
Python :: python string to lowercase 
Python :: cannot create group in read-only mode. keras 
Python :: split string with first numerical value in python 
Python :: 2d array python 
Python :: filtering certain rows in python that contains a part of string 
Python :: midpoint circle drawing algorithm 
Python :: how to combine number of excel files into a single file using python or pandas 
Python :: python get website chrome network tab 
Python :: python selenium teardown class 
Python :: discord embed python 
Python :: how to install python packages in local directory 
Python :: import statsmodels as sm 
Python :: python download images from unsplash 
Python :: how to check whether input is string or not 
Python :: How to calculate accuracy with two lists in python 
Python :: Query a PSQL Database From Python 
Python :: list addition within a list comprehension 
Python :: python replace text 
Python :: how to print values without space in python 
Python :: python check if string is float 
Python :: Python Program to Shuffle Deck of Cards 
Python :: Reversing Ints 
Python :: plot circles in matplotlib 
Python :: set comprehension 
Python :: pip install pandas invalid syntax 
Python :: data types in numpy array 
Python :: torch cos 
Python :: split function python 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =