Python: Iteration and Exceptions

Beginner Python developers, and developers with experience in other languages looking to start programming in Python

Prerequisite
None

Expected Duration
224 minutes

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.

Objective

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

MONTHLY SUBSCRIPTION

$129/month
 

ANNUAL SUBSCRIPTION

$1295/year

Multi-license discounts available for Annual and Monthly subscriptions.