Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

list comprehension in python

# List Comprehension

# If one variable
power = [x**2 for x in range(1, 10)] 
# If need two variables especially
# when you work Dictionary with List Comprehension.
# create a simple (key, value), tuple for context variables x and y
l_Comp = [(x,y) for x, y in employees.items() if y >= 100000]
Source by www.edureka.co #
 
PREVIOUS NEXT
Tagged: #list #comprehension #python
ADD COMMENT
Topic
Name
4+6 =