Review Note

Last Update: 05/03/2024 09:06 PM

Current Deck: Python::Python - Pythonic

Published

Fields:

Front
Name 3 ways to multiple each element in y by 2

y = [1, 2, 3]
Back
1. map(lambda x: x*2, y) # Functional programing

2. [_*2 for _ in y] # List comprehension

2. import numpy as np

y = list(2 * np.array(y)) # Broadcasting

Suggested Changes:

Deck Changes (Suggestion to move the Note to the following Deck):

Field Changes:

Tag Changes: