Abstract
The fifth chapter introduces the reader to defining functions. Since the first chapter, functions have been used. In chapter five the reader is introduced to writing their own functions. Other topics related to defining functions are covered including parameter passing and return values, scope of variables, and the run-time stack. Top-down and bottom-up design are illustrated as well in relationship to defining functions.
The varied parameter passing mechanisms of Python are explored including keyword arguments, default values, and dictionary parameter passing. The nuances of mutable data and parameter passing are also explored. In summary, chapter five goes over all the necessary mechanics of defining functions so that programmers learn to modularize their code as they learn to program.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Mark Lutz. Learning Python. O’Reilly & Associates, Inc., Sebastopol, CA, USA, 2003.
Alex Martelli. Python in a Nutshell. A Desktop Quick Reference; 2nd ed. Nutshell handbook. O’Reilly, Sebastopol, CA, 2006.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2011 Springer-Verlag London Limited
About this chapter
Cite this chapter
Lee, K.D. (2011). Defining Functions. In: Python Programming Fundamentals. Undergraduate Topics in Computer Science. Springer, London. https://doi.org/10.1007/978-1-84996-537-8_5
Download citation
DOI: https://doi.org/10.1007/978-1-84996-537-8_5
Publisher Name: Springer, London
Print ISBN: 978-1-84996-536-1
Online ISBN: 978-1-84996-537-8
eBook Packages: Computer ScienceComputer Science (R0)