Python: Difference between revisions

19 bytes added ,  12 December 2019
Line 15: Line 15:
Install all requirements using <code>pip install -r requirements.txt</code>
Install all requirements using <code>pip install -r requirements.txt</code>


===Ternary Operator===
===Syntax===
 
====Ternary Operator====
[http://book.pythontips.com/en/latest/ternary_operators.html Reference]
[http://book.pythontips.com/en/latest/ternary_operators.html Reference]
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
is_nice = True
is_nice = True
state = "nice" if is_nice else "not nice"
state = "nice" if is_nice else "not nice"
</syntaxhighlight>
====Lambda Function====
<syntaxhighlight lang="python">
lambda x: x * 2
</syntaxhighlight>
</syntaxhighlight>


Line 43: Line 50:
[https://docs.scipy.org/doc/numpy/user/basics.indexing.html Scipy Reference]
[https://docs.scipy.org/doc/numpy/user/basics.indexing.html Scipy Reference]


===Lambda Function===
<syntaxhighlight lang="python">
lambda x: x * 2
</syntaxhighlight>


===Filesystem Read and Write===
===Filesystem Read and Write===