5ORGANIZING VALUES USING LISTS

image

We’ve seen that we can use strings to work with a sequence of characters. In this chapter, we’ll learn about lists, which help us work with sequences of other types of values, such as integers and floats. We’ll also learn that we can nest lists inside of lists, which lets us work with grids of data.

We’ll solve three problems using lists: finding the smallest neighborhood of a collection of villages, determining whether sufficient money has been raised for a school trip, and calculating the number of bonuses offered by a bakery.

Problem #11: Village Neighborhood

In this problem, we’re going to find the size of the ...

Get Learn to Code by Solving Problems 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.