Concepts covered last week
- 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
print()
and formatted output using f-strings
- reserved keywords in Python (e.g.
for
, return
, etc
- operations on strings (strings are “objects” with “methods”)
- getting input from the user using
input()
- getting help using
?
and on web documentation
- commenting code using
#
- conditionals using
if
elif
else
- loops using
while
and for
range()
& zero-based indexing in Python
Concepts to cover this week
- lists, tuples, dictionaries
- list comprehensions in Python (sorry, MATLAB!)
- NumPy arrays, indexing, slicing,
np.zeros()
, np.ones()
, np.arange()
, np.linspace()
, np.random.rand()
, np.random.randn()
, np.random.randint()
- Functions, inputs, outputs,
return
, default arguments, **kwargs
, anonymous functions (lambda
in Python and @
in MATLAB)
iPython notebook from class