Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Engineering LibreTexts

16: Classes and functions

( \newcommand{\kernel}{\mathrm{null}\,}\)

Now that we know how to create new types, the next step is to write functions that take programmer-defined objects as parameters and return them as results. In this chapter I also present “functional programming style” and two new program development plans.

Code examples from this chapter are available from http://thinkpython2.com/code/Time1.py. Solutions to the exercises are at http://thinkpython2.com/code/Time1_soln.py.


This page titled 16: Classes and functions is shared under a CC BY-NC 3.0 license and was authored, remixed, and/or curated by Allen B. Downey (Green Tea Press) via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?