Python 3, Part 2: Statements

with expert Peter Thorsteinson

In this course we are going to take a look at statements and how they fit within the overall program structure. Then we'll take a look at the ‘if’ statement and we'll see how that is used to make decisions. Then we will take a look at looping constructs and how the ‘for’ keyword can be used to iterate over the elements within a sequence. Next we’ll take a look at how the ‘while’ keyword can be used to iterate a loop as long as a Boolean expression remains true. Next are ‘continue’ and ‘break’, we'll see how they can be used to change the normal course of action and the normal flow of a looping construct to either continue back to the top or to break out and continue beyond the end of the loop. Then we'll take a look at the exec function which can be used to execute arbitrary code that is in the form of a string. Then we'll take a look at exception handling, how to raise an exception, and how to catch an exception for dealing with unusual circumstances, in particular dealing with error type situations.

Course Outline