Building and Growing a Dataset

You won't only read data, you'll build it. Start with an empty list and append records as they arrive. This is exactly what a signup form, a survey, or an inventory system does under the hood.

EXAMPLE
loading editor…
YOUR TURN
Your turn → Register two more plots with real crops. Then print the total square footage by adding the two size fields together.
loading editor…

Syntax has to be exact. Every quote, bracket and parenthesis needs its partner, and in Python the spaces at the start of a line count. One slip and the program won't run; the message will say where.

✦ Where this goes next

Right now you reach into records by hand: books[0], books[1], books[2]. In Module 12 a single for-loop walks all of them, however many there are. Then in Module 15 you'll wrap that logic in a named function you can reuse anywhere. Everything you're building here is the foundation for that.

◈ Graded Challenge

Using the books dataset provided, create oldest_title holding the title of the earliest book, and modern_count holding how many were published after 1800. Reach into the data rather than reading it yourself.

Name it exactly: oldest_title, modern_count

2 visible + 1 hidden
loading editor…

Mark this lesson complete

Signed in, your progress follows you to every device.

Next: Practice Test →
← Back