Python: Defining Functions

Опубликовано: 16 Июль 2026
на канале: Barry Brown
88,473
335

A video about writing simple functions in the Python programming language. We start by defining a function in the Python Shell. Then we show how to write the same function in a text editor and include unit tests (using the doctest module).

To use doctest, include the following three lines at the bottom of your file:

if _name_ == "__main__":
import doctest
doctest.testmod(verbose=True, optionflags=doctest.NORMALIZE_WHITESPACE)