User-Defined Functions
Module 5
User-Defined Functions
Purpose of this Video
? Series Goal: Create your own functions
¡ì Not same as designing (a larger course goal)
¡ì Focusing on technical details of writing code
? But need to introduce a lot of terminology
¡ì If you do not know cannot follow lectures
¡ì Will have a glossary on the course web page
? Will also standardize some terminology
¡ì People use words in slightly different ways
Basic Terminology
? Assume familiarity with a function call
¡ì May not remember the exact term
¡ì The name for using a function in python
¡ì Example: round(26.54)
? Arguments are expressions in parentheses
¡ì Example: round(26.54) has one argument
¡ì Example: round(26.54,1) has two arguments
Procedures vs. Functions
? Most functions are expressions
¡ì The call evaluates to a value
¡ì Can nest or use in an assignment statement
¡ì Example: x = round(26.54) puts 2.7 in x
? But some functions are statements
¡ì Example: print('Hello') by itself
¡ì Example: x = print('Hello') makes x empty
? Latter type of functions are called procedures
¡ì All procedures are function, reverse not true
Fruitful Functions
? What to call functions that are not procedures?
¡ì Historically they were called functions
¡ì So functions and procedures distinct
¡ì But the C language called both types functions
¡ì Python kept this terminology
? We will use the term fruitful function
¡ì Because the function is producing a value
¡ì Taken from Allen Downey¡¯ Think Python
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- piecewise defined functions pdf
- user defined function matlab
- tableau user defined function
- programmer defined functions matlab
- defined benefit vs defined contribution
- user defined function in c
- user needs vs user requirements
- piecewise defined functions worksheet with answers
- sql user defined function
- python user defined type
- user defined function in sql
- types of user defined functions in sql