Skip to Content
Python Crash Course, 3rd Edition
book

Python Crash Course, 3rd Edition

by Eric Matthes
January 2023
Intermediate to advanced
552 pages
13h 38m
English
No Starch Press
Content preview from Python Crash Course, 3rd Edition

4 Working with Lists

In Chapter 3 you learned how to make a simple list, and you learned to work with the individual elements in a list. In this chapter you’ll learn how to loop through an entire list using just a few lines of code, regardless of how long the list is. Looping allows you to take the same action, or set of actions, with every item in a list. As a result, you’ll be able to work efficiently with lists of any length, including those with thousands or even millions of items.

Looping Through an Entire List

You’ll often want to run through all entries in a list, performing the same task with each item. For example, in a game you ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Fundamentals with Paul Deitel, 2nd Edition

Python Fundamentals with Paul Deitel, 2nd Edition

Paul Deitel

Publisher Resources

ISBN: 9781098156664