Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python multiply list by scalar

# Using a list comprehension:
l = [x * 2 for x in l]

# Using a lambda function with map:
l = map(lambda x: x * 2, l)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #multiply #list #scalar
ADD COMMENT
Topic
Name
6+7 =