6. List Comprehension and Enumeration

Python version 2.0 introduced some exciting new features that, while not mandatory, can make your Python code more compact, error-free, and streamlined. The current version of Python (Python 3.0) inherits these powerful features.

This chapter explores these features:

Image The built-in enumerate function, which automatically supplies a loop counter.

Image Enhanced use of the format function, to format output.

Image List comprehension ...

Get Python Without Fear now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.