Chapter 2Mad Libs
Now that you are all set up, we’re going to dig into some real coding. In this chapter, we’re going to start with an important topic, one that you will use in every single program you ever write: variables. And to do that, you’ll also learn about functions and create a simple game. Ready?
Understanding Functions
In programming languages, functions are bits of code that perform specific tasks. You’ve actually seen one function already: the print()
function you used at the end of Chapter 1. And, as you saw, print()
does just that, it prints (or displays) text.
In Python, like in most other programming languages, functions ...
Get Captain Code: Unleash Your Coding Superpower with Python 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.