Wednesday, September 14, 2011

LPTHW - Exercise 18

In this exercise, we learn how to define functions. Functions can be thought of as creating custom commands.

We use the 'def' keyword to create functions. The function's body needs to be indented with the same number of spaces in every line.

We can accept a parameter called *args (args can be replaced with anything else). This I believe takes a list of parameters which can be unpacked into multiple arguments as seen in the function 'print_two'

No comments:

Post a Comment