Python¶
Python code is typically written in the form of functions that are stored in libraries (or modules) and made available with the import statement.
Python naturally invites to good software engineering practices in terms of object-oriented programming. Almost everything in Python is an object, with its properties and methods and a class is like an object constructor, or a “blueprint” for creating objects known as instances of the class.
It cannot be overemphasized that the use of object-oriented programming is highly enabling for code sharing and team development, and it is strongly recommended to adopt these practices.
Jupyter notebooks¶
A Jupyter notebook is an application to edit and run notebook documents via a web browser. A notebook document, in turn, is a human readable file in JSON format that contains both program code (written in e.g. Python) and text elements (paragraphs, figures, links, etc. using markdown) organized into cells. Notebook documents containing Python code have the file extension .ipynb.
You start a Jupyter notebook on the command line as follows
$ jupyter labAuto-completion¶
Press tab to auto-complete commands. If there is no unique completion available, a list of suggestions is provided.
E.g. if you enter plt. and press tab, you will get a list of the methods that pyplot implements.
Keyboard shortcuts¶
| Shortcut | Result |
|---|---|
Enter | Enter edit mode of cell |
Shift-Enter | Leave edit mode of cell |
C | Copy cell |
V | Paste cell |
Shift M | Merge cell with that below |
Ctrl-Shift - | Split markdown cell at cursor position |
M | Change cell to markdown type |
Y | Change cell to code type |
Ctrl-S | Save checkpoint of notebook |