CSC180H1 Lecture Notes - Lecture 9: Modular Form, Divisor, Software Engineering
Document Summary
You"ve already encountered functions at the very beginning of the course. A function is a self-contained "black box" that: * returns the result of those operations via the output. By allowing the programmer to define functions, python thus enables you to extend the language to implement, in a convenient modular form, arbitrary functional building blocks. Recall, in exercise one, we asked you to define a function called "square" that, surprisingly, returns the square of its argument. * "def" is used to begin the definition. * "square" is provided as a user-defined name. * the function square will take one argument, which we will refer to as "x" within the body of the function. * by "body" of the function, we refer to all of the code that is indented underneath the "def" keyword. * once defined as above, the python interpreter will now.