SNIPPET
1 Upvote

Apply Functions to List Elements Using Comprehension

Python
General Python

original_list = [10,11,12,13]

def multiply_by_10(x):
    return x * 10

new_list = [multiply_by_10(n) for n in original_list]

new_list

By detro - Last Updated Oct. 30, 2021, 1:37 p.m.

COMMENTS
RELATED SNIPPETS
Python For Else Loop
Python
General Python

Loop

2
1
Search Snippets by Tag: