Basic notes on Python
Exercises from 'Python crash course: A hands-on, project-based introduction to programming' by Matthes 2019
Exercises are written in plain text (*.py) and in Emacs's org-mode (*.org). The latter include exercises' instructions and it is meant to be exported as LaTeX file (*.tex) which can then, be used to produce a pdf file.
Notes from 'Python Data Analytics: With Pandas, NumPy, and Matplotlib' by Nelli 2018
Emacs's org files have a local variable declared at the end which is used to export the code to a .py file every time the file is saved (see this post on stackoverflow). However, note that upon open the file a warning will be shown about potential unsafe local variables.
To convert the *.org file into LaTeX format it should be open in Emacs, where the following key-combination is entered, C-c C-e l l. The C-<letter> indicates that the Ctrl key should be pressed along with a letter; after that the options to export as a latex file are selected with the last two keys (l pressed twice).
Later, a pdf file is produced with XeLaTex with the --shell-escape option
# Example for Ch-3-ex.tex
xelatex --shell-escape Ch-3-ex.texTo change the colors used to highlight the code change the following lines in the file latex_conf.org
#+LATEX_HEADER: \usemintedstyle{pastie}
#+LATEX_HEADER: \setminted[python]{fontsize=\footnotesize, linenos, baselinestretch=1.2, framesep=2mm, frame=lines}
The first line changes the colors (other options can be found elsewhere, e.g. Overleaf). On the second line the specification for the background color (bgcolor=darkgray) was removed resulting in a white color.