Overview
Learning Outcomes
After completing this module, students should understand
-
What statements and expressions are and the differences between them
-
The difference between simple and compound statements and the elements of a compound statement
-
Common operators in Python, including the various division-related operators
-
How to declare and modify variables in Python
-
What a boolean context is and how common values are treated in boolean contexts
-
How to write conditional statements and conditional expressions and how they are different
-
How to write while loops and for loops and when to choose one over the other
-
How to alter the normal flow of control in a loop
-
How to call a function
-
The difference between positional arguments and keyword arguments and how to use each of them
-
How to write a function
-
The difference between required parameters and optional parameters and how to declare each of them
-
The difference between
return
andprint()
-
What function docstrings are and how to write them
-
What an exception is
-
How the Python call stack works and how to read a stack traceback
-
How to raise exceptions
-
How to handle exceptions with try/except statements
Additional Readings
You may find it helpful to refer to the following resources:
-
Severance, Python for Everybody
-
van Rossum, The Python Tutorial
-
Section 3: "An Informal Introduction to Python" Touches on statements, expressions,
while
loops -
Section 4.4: "`break` and
continue
Statements, andelse
Clauses on Loops"
-
-
Python Documentation, "Built-in Functions"