Chapter 2. Textual Data: Every string has its place

image with no caption

Imagine trying to communicate without words.

All programs process data, and one of the most important types of data is text. In this chapter, you’ll work through the basics of textual data. You’ll automatically search text and get back exactly what you’re looking for. Along the way, you’ll pick up key programming concepts such as methods and how you can use them to bend your data to your will. And finally, you’ll instantly power up your programs with the help of library code.

Your new gig at Starbuzz Coffee

Starbuzz Coffee has made a name for itself as the fastest growing coffee shop around. If you’ve seen one on your local corner, look across the street; you’ll see another one.

image with no caption

The Starbuzz CEO is always on the lookout for ways to boost profits, and he’s come up with a great idea. He wants a program that will show him the current price of coffee beans so that his buyers can make informed decisions about when to buy.

image with no caption

Here’s the current Starbuzz code

The previous programmer has already made a head start on the code, and we can use this as a basis. Here’s the existing Python code, but what does it do?

Brain Power

Take a good look at the existing ...

Get Head First Programming 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.