7 Using functions to simplify programs

Image

What you will learn

Functions are an essential part of program design. You can use functions to break up a large solution into individual components and to create libraries of behaviors that can be used by your programs. Up to this point, our programs have worked with functions provided with Python (the print function, for example). In this chapter, you’ll learn how to create and use functions of your own. You’ll see how to give functions data to work on and how a program can receive results that a function returns. Functions make programs more concise and easier to manage.

What makes a function?

Build ...

Get Begin to Code 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.