Abstract
In this chapter, you’ll learn how to group statements into functions, which enables you to tell the computer how to do something, and to tell it only once. You won’t need to give it the same detailed instructions over and over. The chapter provides a thorough introduction to parameters and scoping, and you’ll learn what recursion is and what it can do for your programs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Actually, functions in Python don’t always return values. You’ll learn more about this later in the chapter.
- 2.
In fact, with the estimated number of particles in the observable universe at 1087, you would need only about 290 questions to discern between them!
- 3.
The name “lambda” comes from the Greek letter, which is used in mathematics to indicate an anonymous function.
- 4.
Actually, instead of this lambda function, you could import the function add from the operator module, which has a function for each of the built-in operators. Using functions from the operator module is always more efficient than using your own functions.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2017 Magnus Lie Hetland
About this chapter
Cite this chapter
Hetland, M.L. (2017). Abstraction. In: Beginning Python. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0028-5_6
Download citation
DOI: https://doi.org/10.1007/978-1-4842-0028-5_6
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-0029-2
Online ISBN: 978-1-4842-0028-5
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books