Functions

Ha Khanh Nguyen (hknguyen)


1. What is a Function?

1.1 Defining a function vs. A function call?


2. Function Properties

2.1 Namespaces, scope, and local functions

2.2 Returning multiple values

2.3 Anonymous (labmda) functions


3. Exercise

Write a function named largest_mult_of_three() that takes in 4 input: x, y, z and w (which represents a positive number). Find the largest number that is divisible by 3 among those 4 numbers and return it as the function output.

If none of the numbers are divisible by 3, return -1.


This lecture notes referenced materials from Chapter 3 of Wes McKinney's Python for Data Analysis 2nd Ed.