• Online, Self-Paced
Course Description

Iterations and exceptions are nuanced in Python, and so it is important to fully understand how they work in order to produce quality software. In this course, you will learn about comprehensions, a powerful, concise syntax for creating iterable objects. The course also covers iteration and iterables, and exception handling.

Learning Objectives

Comprehensions

  • start the course
  • create a list comprehension in Python
  • create a nested comprehension in Python
  • use the zip() function in a generator in Python
  • create a set comprehension in Python
  • create a dictionary comprehension in Python

Iterables

  • describe the function of iter(), next() and StopIteration() in Python iteration
  • use the map() function in an iteration in Python
  • use the filter() function in an iteration in Python
  • use functools.reduce() to iterate over an iterable
  • implement a custom iterable class in Python
  • implement an iterable using consecutive integer indexing in Python
  • implement an iterable using the extended iter() function

Generators

  • create a simple generator in Python
  • create a lazy generator in Python and understand its characteristics
  • create a recursive generator in Python

Exceptions

  • write a basic exception handler in Python to catch all exceptions
  • write an exception handler in Python to catch a specific error, and recognize the reason why catching all errors is bad practice
  • describe the inheritance hierarchy of exceptions in Python and how to catch multiple exception types using a base type
  • raise an exception using a payload and retrieve a payload when handling an error
  • create a custom exception class in Python
  • access and manipulate traceback objects for an exception in Python
  • use assertions in a Python program
  • use implicit and explicit chaining of exceptions in Python

Practice: Creating an Iterable

  • create an iterable data type that handles exceptions in Python

Framework Connections

The materials within this course focus on the Knowledge Skills and Abilities (KSAs) identified within the Specialty Areas listed below. Click to view Specialty Area details within the interactive National Cybersecurity Workforce Framework.

Feedback

If you would like to provide feedback for this course, please e-mail the NICCS SO at NICCS@hq.dhs.gov.