Skip to main content

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 18k Accesses

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.

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

References

  1. Mark Lutz. Learning Python. O’Reilly & Associates, Inc., Sebastopol, CA, USA, 2003.

    Google Scholar 

  2. Alex Martelli. Python in a Nutshell. A Desktop Quick Reference; 2nd ed. Nutshell handbook. O’Reilly, Sebastopol, CA, 2006.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Kent D. Lee .

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics