if test:
    def func():          # Define func this way.
        ... 
else:
    def func():          # Or else this way instead.
        ...
...
func()                   # Call the version selected and built.



othername = func         # Assign function object.
othername()              # Call func again.



>>> def times(x, y):      # Create and assign function.
...     return x * y      # Body executed when called.
...



>>> times(2, 4)           # Arguments in parentheses
8



>>> x = times(3.14, 4)    # Save the result object.
>>> x
12.56



>>> times('Ni', 4)        # Functions are "typeless."
'NiNiNiNi'



def intersect(seq1, seq2):
    res = []                     # Start empty.
    for x in seq1:               # Scan seq1.
        if x in seq2:            # Common item?
            res.append(x)        # Add to end.
    return res



>>> s1 = "SPAM"
>>> s2 = "SCAM"

>>> intersect(s1, s2)                   # Strings
['S', 'A', 'M']



>>> x = intersect([1, 2, 3], (1, 4))    # Mixed types
>>> x                                   # Saved result object
[1]

