Skip to Content
Head First Python, 3rd Edition
book

Head First Python, 3rd Edition

by Paul Barry
August 2023
Beginner
666 pages
15h 44m
English
O'Reilly Media, Inc.
Content preview from Head First Python, 3rd Edition

Chapter 5. Formatted String Literals: Make Charts from Data

Image

Sometimes it’s the simplest approaches that get the job done.

In this chapter you finally get around to producing bar charts for the Coach. You’ll do this using nothing but strings. You already know that Python’s strings come packed full of built-in goodness, and Python’s formatted string literals, aka f-strings, enhance what’s possible in some rather neat ways. It might feel weird that we’re proposing creating bar charts with text but, as you’re about to discover, it’s not as absurd as it sounds. Along the way you’ll use Python to create files as well as launch a web browser with just a few lines of code. Finally, the Coach gets his wish: the automatic generation of charts from his swim times data. Let’s get to it!

Image

That’s great to hear, as we have all the data we need.

Now all we have to do is work out how to turn the data into a bar chart.

Image
Image

So do we.

There’s no other choice. It’s time for a sit down with The Coach.

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

Head First Python, 2nd Edition

Head First Python, 2nd Edition

Paul Barry

Publisher Resources

ISBN: 9781492051282Errata Page