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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.