Created
April 13, 2020 01:57
-
-
Save ahmedazizkhelifi/ee171b497b06d55742165f6ec3f288dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L= [0,1,2,3,4,5,6,7,8,9] | |
def condition(x): | |
return x>4 | |
L2 = list(filter(condition,L)) | |
# >>> [5, 6, 7, 8, 9] | |
L3 = list(filter(lambda x : x > 4 , L )) | |
# >>> [5, 6, 7, 8, 9] | |
import numpy as np | |
np.fromfunction(lambda i,j : i-j, (3,3)) | |
#array([[ 0., -1., -2.], | |
# [ 1., 0., -1.], | |
# [ 2., 1., 0.]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment