Week 1
- Python install
- VS Code install
- editing a
.py
Python program and executing it in the shell
- the REPL
- expressions and evaluating them
- mathematical operators and operator precedence
- using brackets
(
and )
to override operator precedence
- numeric vs character string data types
Week 2
- variables:
str
, int
, float
, bool
, inspect using type()
- conversion:
str()
, int()
, float()
- operators:
+
-
*
/
, **
, modulus %
- logical operators
<
>
==
>=
<=
!=
and
or
not
True
False
- operator precedence, using brackets
(
)
to save your sanity
import
statements—for example, from math import cos
print()
and formatted output using f-strings
- getting input from the user using
input()
- commenting code using
#
- reserved keywords in Python (e.g.
for
, return
, etc)
- operations on strings (strings are “objects” with “methods”)
- getting help using
help()
- conditionals using
if
elif
else
- the
list
variable type in Python
- loops using
while
and for
range()
& zero-based indexing in Python
Week 3
- in Python list variables are pointers
b = a
vs b = a.copy()
- NumPy arrays
- creating arrays
np.zeros()
and np.ones()
- shape of arrays using
np.shape()
- multidimensional arrays
- vectorized operations on arrays
- slicing & indexing into arrays
- functions in Python
- defining a function
- function header
- inputs
- the work
- outputs
- variable scope
- named inputs
- default values
- idea of modularity of code
Week 4
- Python dictionaries
- Python list comprehensions
- using the
enumerate
keyword in for loops
- hexadecimal
- Python functions as variables
- progress bar using
tqdm
- file input & output: low-level
- all files are binary, a series of 8-bit bytes
- ASCII encoding (and utf-8 more modern version)
- using hex editor to view a file as hexadecimal bytes
- Python defaults: 32-bit int, 64-bit float, 8-bit char
- little-endian vs big-endian byte ordering (
sys.byteorder
to check)
- using numpy to read and write binary bytes by specifying
dtype
- file input & output: high-level using NumPy & pandas
Week 5
- procedural programming: functions acting on data structures
- object-oriented programming (OOP): classes & objects encapsulate attributes & methods
- hierarchical organization of Classes (and superclasses and subclasses)
- attributes (data)
- methods (functions)
- the
__init__()
method and the self
variable
- inheritance
- overriding inherited methods
- polymorphism
super().__init__()
- special methods:
__str__()
and __repr__()
- copying objects
- shallow copy using the
copy
module copy.copy()
- deep copy using
copy.deepcopy()
- operator overloading, e.g.
__eq()__
, __lt__()
, __gt__()
Week 6
- matplotlib in Python
plt.plot()
& plt.show()
- dots, lines, colours, shapes
plt.subplot()
vs fig, ax = plt.subplots()
- axis labels, axis limits
- figure title
- legend
fig.tight_layout()
fig.savefig()
- graphics file formats
- bitmap vs vector graphics