Made some changes to the script embellishing a plot, but it still needs changes.
Writing an if/elif/else block:
\begin{lstlisting}
if condition1:
# do A, B, C
elif condition2:
# do D, E
else:
# do Y, Z
\end{lstlisting}
The ternary operator:
{\ex \lstinline| C if X else Y|} -- Do C if X is True else do Y.