Chapter 11Getting Func-ky

Image

Welcome to Part II. In this section you are going to build a retro-style text adventure game. Along the way, you’ll learn lots of new techniques for creating powerful applications. But first we need to revisit functions, and this time you’ll learn how to write your own functions.

Functions Revisited

You know what functions are. You’ve seen and used lots of them: input(), print(), int(), now(), upper(), choice(), and many others.

As a reminder, a function is made up of three parts:

Part

Description

Required

Example

Name

The unique function name

Yes

An example is print(). The name is how you call the function ...

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.