Skip to main content

User-Defined Functions

  • Chapter
  • First Online:
Learn to Program with Python
  • 12k Accesses

Abstract

Software is a detailed set of instructions that tell the computer what to do. There are numerous examples where we, as humans, follow a set of such instructions. As a simple example, many pieces of furniture from IKEA come with a set of high-level instructions in the form of pictures. When creating these instructions, the people at IKEA assume a certain level of basic knowledge of how to use tools, such as a wrench, a screwdriver, a hammer, and so forth. But using each of these tools could be broken down into simpler steps. Using a hammer could be broken down into grip the hammer by the handle, hold the nail perpendicular to the surface, tap the nail with the head of the hammer to get it started, then hit the nail harder, and so forth. Once you understand the steps involved in using a hammer, you can apply your hammer skills any time a set of instructions calls for you to use one, without having to worry about the details. Creating detailed “low-level” descriptions of steps (like how to use a hammer) is very similar to the way that software is built. In this chapter, you learn how to create these types of software groupings.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Irv Kalb

About this chapter

Cite this chapter

Kalb, I. (2016). User-Defined Functions. In: Learn to Program with Python. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2172-3_4

Download citation

Publish with us

Policies and ethics