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
users_name3 =[user['name'] for user in Users if user['name'][0]=="A"] | |
print(users_name3) #>>> ['Ahmed', 'Aziz'] |
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
Users= [ | |
{'id' : 0, 'name' : 'Ahmed', 'salary' : 1200}, | |
{'id' : 1, 'name' : 'Aziz', 'salary' : 1800}, | |
{'id' : 2, 'name' : 'Khelifi', 'salary' : 820} | |
] | |
#conventional syntax: | |
users_name=[] | |
for user in Users: | |
users_name.append(user['name']) |
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 |
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
def add_def(x,y): | |
return x+y | |
add_lambda = lambda x,y : x+y | |
add_def(5,3) # >>> 8 | |
add_lambda(5,3) # >>> 8 |
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
def maxi(a,b): | |
return max(a,b) | |
print(maxi(1,2)) | |
print(maxi(1,a)) #>> NameError: name 'a' is not defined |
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
def maxi(a,b): | |
return max(a,b) | |
import pdb | |
pdb.set_trace() | |
print(maxi(1,2)) | |
print(maxi(1,a)) |
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
$$ | |
\frac{arg 1}{arg 2} \\ | |
x^2\\ | |
e^{i\pi}\\ | |
A_i\\ | |
B_{ij}\\ | |
\sqrt[n]{arg} | |
$$ |
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
#Other Symbols | |
## Angles: | |
Left angle : $\langle$ | |
Right angle : $\rangle$ | |
Angle between two vectors u and v : $\langle \vec{u},\vec{v}\rangle$ | |
$$ \vec{AB} \, \cdot \, \vec{CD} =0 \Rightarrow \vec{AB} \, \perp\, \vec{CD}$$ |
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
$$ | |
\sin(-\alpha)=-\sin(\alpha)\\ | |
\arccos(x)=\arcsin(u)\\ | |
\log_n(n)=1\\ | |
\tan(x) = \frac{\sin(x)}{\cos(x)} | |
$$ |
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
Given : $\pi = 3.14$ , $\alpha = \frac{3\pi}{4}\, rad$ | |
$$ | |
\omega = 2\pi f \\ | |
f = \frac{c}{\lambda}\\ | |
\lambda_0=\theta^2+\delta\\ | |
\Delta\lambda = \frac{1}{\lambda^2} | |
$$ |