Chapter 3. Lists of Numbers: Processing List Data
The more code you write, the better you get. It’s that simple.
In this chapter, you continue to create Python code to help the Coach. You learn how to read data from a Coach-supplied data file, sucking its lines into a list, one of Python’s most-powerful built-in data structures. As well as creating lists from the file’s data, you’ll also learn how to create lists from scratch, growing your list dynamically as need be. And you’ll process lists using one of Python’s most popular looping constructs: the for loop. You’ll convert values from one data format to another, and you’ll even make a new best friend (your very own Python BFF). You’ve had your fill of coffee and pie, so it’s time to roll up your sleeves and get back to work.
Task #2: Process the data in the file
With Task #1 complete, it’s time to move onto Task #2. There’s a bit of work to do but, as with the previous chapter’s activities, you can approach things bit-by-bit as detailed in the last chapter:
Read the lines from the file.
Ignore the second line.
Break the first ...
Get Head First Python, 3rd Edition 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.